-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathbehavior.html
More file actions
456 lines (433 loc) · 45 KB
/
behavior.html
File metadata and controls
456 lines (433 loc) · 45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Behavior changes — Matplotlib 3.2.1 documentation</title>
<link rel="stylesheet" href="../../../_static/mpl.css?v3.2.1-13-g7a9bc5ebb-dirty" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../../../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/gallery.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/gallery-binder.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/gallery-dataframe.css" />
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/language_data.js"></script>
<script src="../../../_static/clipboard.min.js"></script>
<script src="../../../_static/copybutton.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Matplotlib 3.2.1 documentation"
href="../../../_static/opensearch.xml"/>
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="top" title="Matplotlib 3.2.1 documentation" href="#" />
<link rel="canonical" href="https://matplotlib.org/3.3.0/api/prev_api_changes/api_changes_3.2.0/behavior.html" />
<link rel="stylesheet" href="../../../_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div id="unreleased-message"> You are reading an old version of the documentation (v3.2.1). For the latest version see <a href="/stable/">https://matplotlib.org/stable/</a> </div>
<div id="annc-banner">
<p>John Hunter Excellence in Plotting Contest 2020
<a href="https://jhepc.github.io/about.html"> submissions are open!
</a>
Entries are due June 1, 2020.</p>
</div>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px; position: relative;">
<a href="../../../index.html">
<div style="float: left; position: absolute; width: 496px; bottom: 0; padding-bottom: 24px"><span style="float: right; color: #789; background: white">Version 3.2.1</span></div>
<img src="../../../_static/logo2_compressed.svg" height="125px" border="0" alt="matplotlib"/></a>
<!-- The "Fork me on github" ribbon -->
<div id="forkongithub"><a href="https://github.com/matplotlib/matplotlib">Fork me on GitHub</a></div>
</div>
<nav class="main-nav">
<ul>
<li><a href="../../../users/installing.html">Installation</a></li>
<li><a href="../../../contents.html">Documentation</a></li>
<li><a href="../../../gallery/index.html">Examples</a></li>
<li><a href="../../../tutorials/index.html">Tutorials</a></li>
<li><a href="../../../devel/index.html">Contributing</a></li>
<li class="nav-right">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" placeholder="Search"/>
</form>
</li>
</ul>
</nav>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">home</a>| </li>
<li><a href="../../../contents.html">contents</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../../../contents.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Behavior changes</a><ul>
<li><a class="reference internal" href="#reduced-default-value-of-rcparams-axes-formatter-limits-default-5-6">Reduced default value of <code class="docutils literal notranslate"><span class="pre">rcParams["axes.formatter.limits"]</span></code> (default: [-5, 6])</a></li>
<li><a class="reference internal" href="#matplotlib-colorbar-colorbar-uses-un-normalized-axes-for-all-mappables"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.colorbar.Colorbar</span></code> uses un-normalized axes for all mappables</a></li>
<li><a class="reference internal" href="#moviewriterregistry"><code class="xref py py-obj docutils literal notranslate"><span class="pre">MovieWriterRegistry</span></code></a></li>
<li><a class="reference internal" href="#autoscaling">Autoscaling</a></li>
<li><a class="reference internal" href="#log-scale-bar-hist-autolimits">log-scale bar() / hist() autolimits</a></li>
<li><a class="reference internal" href="#axes-labels-spanning-multiple-rows-columns">Axes labels spanning multiple rows/columns</a></li>
<li><a class="reference internal" href="#locators">Locators</a></li>
<li><a class="reference internal" href="#nonsingular-locators">nonsingular Locators</a></li>
<li><a class="reference internal" href="#get-data-ratio"><code class="docutils literal notranslate"><span class="pre">get_data_ratio</span></code></a></li>
<li><a class="reference internal" href="#artist-sticky-edges">Artist sticky edges</a></li>
<li><a class="reference internal" href="#gid-in-svg-output"><code class="docutils literal notranslate"><span class="pre">gid</span></code> in svg output</a></li>
<li><a class="reference internal" href="#fonts">Fonts</a></li>
<li><a class="reference internal" href="#color-like-checking">Color-like checking</a></li>
<li><a class="reference internal" href="#default-image-interpolation">Default image interpolation</a></li>
<li><a class="reference internal" href="#rcparams">rcParams</a></li>
<li><a class="reference internal" href="#add-subplot"><code class="docutils literal notranslate"><span class="pre">add_subplot()</span></code></a></li>
<li><a class="reference internal" href="#indicate-inset"><code class="docutils literal notranslate"><span class="pre">indicate_inset()</span></code></a></li>
<li><a class="reference internal" href="#pgf-backend">PGF backend</a></li>
<li><a class="reference internal" href="#cbook"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cbook</span></code></a></li>
<li><a class="reference internal" href="#testing">Testing</a></li>
<li><a class="reference internal" href="#backend-supports-blit">Backend <code class="docutils literal notranslate"><span class="pre">supports_blit</span></code></a></li>
<li><a class="reference internal" href="#exception-changes">Exception changes</a></li>
<li><a class="reference internal" href="#mplot3d-auto-registration">mplot3d auto-registration</a></li>
<li><a class="reference internal" href="#symlognorm-now-has-a-base-parameter"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SymLogNorm</span></code> now has a <em>base</em> parameter</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../../../contents.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="sidebar-pagesource" role="note" aria-label="source link"
style="margin-top: 1.5em; padding-top: 0.1em; border-top: 1px solid #86989b">
<a href="../../../_sources/api/prev_api_changes/api_changes_3.2.0/behavior.rst.txt"
style="color: #c0c0c0" rel="nofollow">Show Page Source</a>
</div>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="behavior-changes">
<h1>Behavior changes<a class="headerlink" href="#behavior-changes" title="Permalink to this headline">¶</a></h1>
<div class="section" id="reduced-default-value-of-rcparams-axes-formatter-limits-default-5-6">
<h2>Reduced default value of <code class="docutils literal notranslate"><a class="reference external" href="../../../tutorials/introductory/customizing.html?highlight=axes.formatter.limits#a-sample-matplotlibrc-file"><span class="pre">rcParams["axes.formatter.limits"]</span></a></code> (default: [-5, 6])<a class="headerlink" href="#reduced-default-value-of-rcparams-axes-formatter-limits-default-5-6" title="Permalink to this headline">¶</a></h2>
<p>Changed the default value of <code class="docutils literal notranslate"><a class="reference external" href="../../../tutorials/introductory/customizing.html?highlight=axes.formatter.limits#a-sample-matplotlibrc-file"><span class="pre">rcParams["axes.formatter.limits"]</span></a></code> (default: [-5, 6]) from -7, 7 to
-5, 6 for better readability.</p>
<p>(<a class="reference external" href="../../../api/prev_api_changes/api_changes_3.2.0/behavior-1.py">Source code</a>, <a class="reference external" href="../../../api/prev_api_changes/api_changes_3.2.0/behavior-1.png">png</a>, <a class="reference external" href="../../../api/prev_api_changes/api_changes_3.2.0/behavior-1.pdf">pdf</a>)</p>
<div class="figure align-default">
<img alt="../../../_images/behavior-1.png" src="../../../_images/behavior-1.png" />
</div>
</div>
<div class="section" id="matplotlib-colorbar-colorbar-uses-un-normalized-axes-for-all-mappables">
<h2><a class="reference internal" href="../../colorbar_api.html#matplotlib.colorbar.Colorbar" title="matplotlib.colorbar.Colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.colorbar.Colorbar</span></code></a> uses un-normalized axes for all mappables<a class="headerlink" href="#matplotlib-colorbar-colorbar-uses-un-normalized-axes-for-all-mappables" title="Permalink to this headline">¶</a></h2>
<p>Before 3.0, <a class="reference internal" href="../../colorbar_api.html#matplotlib.colorbar.Colorbar" title="matplotlib.colorbar.Colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.colorbar.Colorbar</span></code></a> (<a class="reference internal" href="../../_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.colorbar" title="matplotlib.figure.Figure.colorbar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">colorbar</span></code></a>) normalized
all axes limits between 0 and 1 and had custom tickers to handle the
labelling of the colorbar ticks. After 3.0, colorbars constructed from
mappables that were <em>not</em> contours were constructed with axes that had
limits between <code class="docutils literal notranslate"><span class="pre">vmin</span></code> and <code class="docutils literal notranslate"><span class="pre">vmax</span></code> of the mappable's norm, and the tickers
were made children of the normal axes tickers.</p>
<p>This version of Matplotlib extends that to mappables made by contours, and
allows the axes to run between the lowest boundary in the contour and the
highest.</p>
<p>Code that worked around the normalization between 0 and 1 will need to be
modified.</p>
</div>
<div class="section" id="moviewriterregistry">
<h2><code class="xref py py-obj docutils literal notranslate"><span class="pre">MovieWriterRegistry</span></code><a class="headerlink" href="#moviewriterregistry" title="Permalink to this headline">¶</a></h2>
<p><code class="xref py py-obj docutils literal notranslate"><span class="pre">MovieWriterRegistry</span></code> now always checks the availability of the writer classes
before returning them. If one wishes, for example, to get the first available
writer, without performing the availability check on subsequent writers, it is
now possible to iterate over the registry, which will yield the names of the
available classes.</p>
</div>
<div class="section" id="autoscaling">
<h2>Autoscaling<a class="headerlink" href="#autoscaling" title="Permalink to this headline">¶</a></h2>
<p>Matplotlib used to recompute autoscaled limits after every plotting
(<code class="docutils literal notranslate"><span class="pre">plot()</span></code>, <code class="docutils literal notranslate"><span class="pre">bar()</span></code>, etc.) call. It now only does so when actually
rendering the canvas, or when the user queries the Axes limits. This is a
major performance improvement for plots with a large number of artists.</p>
<p>In particular, this means that artists added manually with <code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.add_line</span></code>,
<code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.add_patch</span></code>, etc. will be taken into account by the autoscale, even
without an explicit call to <code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.autoscale_view</span></code>.</p>
<p>In some cases, this can result in different limits being reported. If this is
an issue, consider triggering a draw with <code class="xref py py-obj docutils literal notranslate"><span class="pre">fig.canvas.draw</span></code>.</p>
<p>Autoscaling has also changed for artists that are based on the <a class="reference internal" href="../../collections_api.html#matplotlib.collections.Collection" title="matplotlib.collections.Collection"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Collection</span></code></a>
class. Previously, the method that calculates the automatic limits
<a class="reference internal" href="../../collections_api.html#matplotlib.collections.Collection.get_datalim" title="matplotlib.collections.Collection.get_datalim"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Collection.get_datalim</span></code></a> tried to take into account the size of objects
in the collection and make the limits large enough to not clip any of the
object, i.e., for <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.scatter.html#matplotlib.axes.Axes.scatter" title="matplotlib.axes.Axes.scatter"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.scatter</span></code></a> it would make the limits large enough to not
clip any markers in the scatter. This is problematic when the object size is
specified in physical space, or figure-relative space, because the transform
from physical units to data limits requires knowing the data limits, and
becomes invalid when the new limits are applied. This is an inverse
problem that is theoretically solvable (if the object is physically smaller
than the axes), but the extra complexity was not deemed worth it, particularly
as the most common use case is for markers in scatter that are usually small
enough to be accommodated by the default data limit margins.</p>
<p>While the new behavior is algorithmically simpler, it is conditional on
properties of the <a class="reference internal" href="../../collections_api.html#matplotlib.collections.Collection" title="matplotlib.collections.Collection"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Collection</span></code></a> object:</p>
<blockquote>
<div><ol class="arabic simple">
<li><code class="docutils literal notranslate"><span class="pre">offsets</span> <span class="pre">=</span> <span class="pre">None</span></code>, <code class="docutils literal notranslate"><span class="pre">transform</span></code> is a child of <code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.transData</span></code>: use the paths
for the automatic limits (i.e. for <a class="reference internal" href="../../collections_api.html#matplotlib.collections.LineCollection" title="matplotlib.collections.LineCollection"><code class="xref py py-obj docutils literal notranslate"><span class="pre">LineCollection</span></code></a> in <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.streamplot.html#matplotlib.axes.Axes.streamplot" title="matplotlib.axes.Axes.streamplot"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.streamplot</span></code></a>).</li>
<li><code class="docutils literal notranslate"><span class="pre">offsets</span> <span class="pre">!=</span> <span class="pre">None</span></code>, and <code class="docutils literal notranslate"><span class="pre">offset_transform</span></code> is child of <code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.transData</span></code>:</li>
</ol>
<blockquote>
<div><ol class="loweralpha simple">
<li><dl class="first docutils">
<dt><code class="docutils literal notranslate"><span class="pre">transform</span></code> is child of <code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.transData</span></code>: use the <code class="docutils literal notranslate"><span class="pre">path</span> <span class="pre">+</span> <span class="pre">offset</span></code> for</dt><dd>limits (i.e., for <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.bar.html#matplotlib.axes.Axes.bar" title="matplotlib.axes.Axes.bar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.bar</span></code></a>).</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><code class="docutils literal notranslate"><span class="pre">transform</span></code> is not a child of <code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.transData</span></code>: just use the offsets</dt><dd>for the limits (i.e. for scatter)</dd>
</dl>
</li>
</ol>
</div></blockquote>
<ol class="arabic simple" start="3">
<li>otherwise return a null <a class="reference internal" href="../../transformations.html#matplotlib.transforms.Bbox" title="matplotlib.transforms.Bbox"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Bbox</span></code></a>.</li>
</ol>
</div></blockquote>
<p>While this seems complicated, the logic is simply to use the information from
the object that are in data space for the limits, but not information that is
in physical units.</p>
</div>
<div class="section" id="log-scale-bar-hist-autolimits">
<h2>log-scale bar() / hist() autolimits<a class="headerlink" href="#log-scale-bar-hist-autolimits" title="Permalink to this headline">¶</a></h2>
<p>The autolimits computation in <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.bar.html#matplotlib.axes.Axes.bar" title="matplotlib.axes.Axes.bar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">bar</span></code></a> and <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.hist.html#matplotlib.axes.Axes.hist" title="matplotlib.axes.Axes.hist"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hist</span></code></a> when the axes
already uses log-scale has changed to match the computation when the axes is
switched to log-scale after the call to <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.bar.html#matplotlib.axes.Axes.bar" title="matplotlib.axes.Axes.bar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">bar</span></code></a> and <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.hist.html#matplotlib.axes.Axes.hist" title="matplotlib.axes.Axes.hist"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hist</span></code></a>, and
when calling <code class="docutils literal notranslate"><span class="pre">bar(...,</span> <span class="pre">log=True)</span></code> / <code class="docutils literal notranslate"><span class="pre">hist(...,</span> <span class="pre">log=True)</span></code>: if there are
at least two different bar heights, add the normal axes margins to them (in
log-scale); if there is only a single bar height, expand the axes limits by one
order of magnitude around it and then apply axes margins.</p>
</div>
<div class="section" id="axes-labels-spanning-multiple-rows-columns">
<h2>Axes labels spanning multiple rows/columns<a class="headerlink" href="#axes-labels-spanning-multiple-rows-columns" title="Permalink to this headline">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">Axes.label_outer</span></code> now correctly keep the x labels and tick labels visible
for Axes spanning multiple rows, as long as they cover the last row of the Axes
grid. (This is consistent with keeping the y labels and tick labels visible
for Axes spanning multiple columns as long as they cover the first column of
the Axes grid.)</p>
<p>The <code class="docutils literal notranslate"><span class="pre">Axes.is_last_row</span></code> and <code class="docutils literal notranslate"><span class="pre">Axes.is_last_col</span></code> methods now correctly return
True for Axes spanning multiple rows, as long as they cover the last row or
column respectively. Again this is consistent with the behavior for axes
covering the first row or column.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">Axes.rowNum</span></code> and <code class="docutils literal notranslate"><span class="pre">Axes.colNum</span></code> attributes are deprecated, as they only
refer to the first grid cell covered by the Axes. Instead, use the new
<code class="docutils literal notranslate"><span class="pre">ax.get_subplotspec().rowspan</span></code> and <code class="docutils literal notranslate"><span class="pre">ax.get_subplotspec().colspan</span></code>
properties, which are <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#range" title="(in Python v3.8)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">range</span></code></a> objects indicating the whole span of rows and
columns covered by the subplot.</p>
<p>(Note that all methods and attributes mentioned here actually only exist on
the <code class="docutils literal notranslate"><span class="pre">Subplot</span></code> subclass of <code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes</span></code>, which is used for grid-positioned Axes but
not for Axes positioned directly in absolute coordinates.)</p>
<p>The <a class="reference internal" href="../../_as_gen/matplotlib.gridspec.GridSpec.html#matplotlib.gridspec.GridSpec" title="matplotlib.gridspec.GridSpec"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GridSpec</span></code></a> class gained the <code class="docutils literal notranslate"><span class="pre">nrows</span></code> and <code class="docutils literal notranslate"><span class="pre">ncols</span></code> properties as more
explicit synonyms for the parameters returned by <code class="docutils literal notranslate"><span class="pre">GridSpec.get_geometry</span></code>.</p>
</div>
<div class="section" id="locators">
<h2>Locators<a class="headerlink" href="#locators" title="Permalink to this headline">¶</a></h2>
<p>When more than <a class="reference internal" href="../../ticker_api.html#matplotlib.ticker.Locator.MAXTICKS" title="matplotlib.ticker.Locator.MAXTICKS"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Locator.MAXTICKS</span></code></a> ticks are generated, the behavior of
<a class="reference internal" href="../../ticker_api.html#matplotlib.ticker.Locator.raise_if_exceeds" title="matplotlib.ticker.Locator.raise_if_exceeds"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Locator.raise_if_exceeds</span></code></a> changed from raising a RuntimeError to emitting a
log at WARNING level.</p>
</div>
<div class="section" id="nonsingular-locators">
<h2>nonsingular Locators<a class="headerlink" href="#nonsingular-locators" title="Permalink to this headline">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">Locator.nonsingular</span></code> (introduced in mpl 3.1), <code class="docutils literal notranslate"><span class="pre">DateLocator.nonsingular</span></code>, and
<code class="docutils literal notranslate"><span class="pre">AutoDateLocator.nonsingular</span></code> now returns a range <code class="docutils literal notranslate"><span class="pre">v0,</span> <span class="pre">v1</span></code> with <code class="docutils literal notranslate"><span class="pre">v0</span> <span class="pre"><=</span> <span class="pre">v1</span></code>.
This behavior is consistent with the implementation of <code class="docutils literal notranslate"><span class="pre">nonsingular</span></code> by the
<code class="docutils literal notranslate"><span class="pre">LogLocator</span></code> and <code class="docutils literal notranslate"><span class="pre">LogitLocator</span></code> subclasses.</p>
</div>
<div class="section" id="get-data-ratio">
<h2><code class="docutils literal notranslate"><span class="pre">get_data_ratio</span></code><a class="headerlink" href="#get-data-ratio" title="Permalink to this headline">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">Axes.get_data_ratio</span></code> now takes the axes scale into account (linear, log,
logit, etc.) before computing the y-to-x ratio. This change allows fixed
aspects to be applied to any combination of x and y scales.</p>
</div>
<div class="section" id="artist-sticky-edges">
<h2>Artist sticky edges<a class="headerlink" href="#artist-sticky-edges" title="Permalink to this headline">¶</a></h2>
<p>Previously, the <code class="docutils literal notranslate"><span class="pre">sticky_edges</span></code> attribute of artists was a list of values such
that if an axis limit coincides with a sticky edge, it would not be expanded by
the axes margins (this is the mechanism that e.g. prevents margins from being
added around images).</p>
<p><code class="docutils literal notranslate"><span class="pre">sticky_edges</span></code> now have an additional effect on margins application: even if
an axis limit did not coincide with a sticky edge, it cannot <em>cross</em> a sticky
edge through margin application -- instead, the margins will only expand the
axis limit until it bumps against the sticky edge.</p>
<p>This change improves the margins of axes displaying a <code class="xref py py-obj docutils literal notranslate"><span class="pre">streamplot</span></code>:</p>
<ul class="simple">
<li>if the streamplot goes all the way to the edges of the vector field, then the
axis limits are set to match exactly the vector field limits (whereas they
would sometimes be off by a small floating point error previously).</li>
<li>if the streamplot does not reach the edges of the vector field (e.g., due to
the use of <code class="docutils literal notranslate"><span class="pre">start_points</span></code> and <code class="docutils literal notranslate"><span class="pre">maxlength</span></code>), then margins expansion will
not cross the vector field limits anymore.</li>
</ul>
<p>This change is also used internally to ensure that polar plots don't display
negative <em>r</em> values unless the user really passes in a negative value.</p>
</div>
<div class="section" id="gid-in-svg-output">
<h2><code class="docutils literal notranslate"><span class="pre">gid</span></code> in svg output<a class="headerlink" href="#gid-in-svg-output" title="Permalink to this headline">¶</a></h2>
<p>Previously, if a figure, axis, legend or some other artists had a custom
<code class="docutils literal notranslate"><span class="pre">gid</span></code> set (e.g. via <code class="docutils literal notranslate"><span class="pre">.set_gid()</span></code>), this would not be reflected in
the svg output. Instead a default gid, like <code class="docutils literal notranslate"><span class="pre">figure_1</span></code> would be shown.
This is now fixed, such that e.g. <code class="docutils literal notranslate"><span class="pre">fig.set_gid("myfigure")</span></code> correctly
shows up as <code class="docutils literal notranslate"><span class="pre"><g</span> <span class="pre">id="myfigure"></span></code> in the svg file. If you relied on the
gid having the default format, you now need to make sure not to set the
<code class="docutils literal notranslate"><span class="pre">gid</span></code> parameter of the artists.</p>
</div>
<div class="section" id="fonts">
<h2>Fonts<a class="headerlink" href="#fonts" title="Permalink to this headline">¶</a></h2>
<p>Font weight guessing now first checks for the presence of the FT_STYLE_BOLD_FLAG
before trying to match substrings in the font name. In particular, this means
that Times New Roman Bold is now correctly detected as bold, not normal weight.</p>
</div>
<div class="section" id="color-like-checking">
<h2>Color-like checking<a class="headerlink" href="#color-like-checking" title="Permalink to this headline">¶</a></h2>
<p><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.color.is_colorlike()</span></code> used to return True for all string
representations of floats. However, only those with values in 0-1 are valid
colors (representing grayscale values). <code class="docutils literal notranslate"><span class="pre">is_colorlike()</span></code> now returns False
for string representations of floats outside 0-1.</p>
</div>
<div class="section" id="default-image-interpolation">
<h2>Default image interpolation<a class="headerlink" href="#default-image-interpolation" title="Permalink to this headline">¶</a></h2>
<p>Images displayed in Matplotlib previously used nearest-neighbor
interpolation, leading to aliasing effects for downscaling and non-integer
upscaling.</p>
<p>New default for <code class="docutils literal notranslate"><a class="reference external" href="../../../tutorials/introductory/customizing.html?highlight=image.interpolation#a-sample-matplotlibrc-file"><span class="pre">rcParams["image.interpolation"]</span></a></code> (default: 'antialiased') is the new option "antialiased".
<code class="xref py py-obj docutils literal notranslate"><span class="pre">imshow(A,</span> <span class="pre">interpolation='antialiased')</span></code> will apply a Hanning filter when
resampling the data in A for display (or saving to file) <em>if</em> the upsample
rate is less than a factor of three, and not an integer; downsampled data is
always smoothed at resampling.</p>
<p>To get the old behavior, set <code class="docutils literal notranslate"><a class="reference external" href="../../../tutorials/introductory/customizing.html?highlight=image.interpolation#a-sample-matplotlibrc-file"><span class="pre">rcParams["image.interpolation"]</span></a></code> (default: 'antialiased') to the old default "nearest"
(or specify the <code class="docutils literal notranslate"><span class="pre">interpolation</span></code> kwarg of <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.imshow.html#matplotlib.axes.Axes.imshow" title="matplotlib.axes.Axes.imshow"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Axes.imshow</span></code></a>)</p>
<p>To always get the anti-aliasing behavior, no matter what the up/down sample
rate, set <code class="docutils literal notranslate"><a class="reference external" href="../../../tutorials/introductory/customizing.html?highlight=image.interpolation#a-sample-matplotlibrc-file"><span class="pre">rcParams["image.interpolation"]</span></a></code> (default: 'antialiased') to "hanning" (or one of the other filters
available).</p>
<p>Note that the "hanning" filter was chosen because it has only a modest
performance penalty. Anti-aliasing can be improved with other filters.</p>
</div>
<div class="section" id="rcparams">
<h2>rcParams<a class="headerlink" href="#rcparams" title="Permalink to this headline">¶</a></h2>
<p>When using <code class="xref py py-obj docutils literal notranslate"><span class="pre">RendererSVG</span></code> with <code class="docutils literal notranslate"><span class="pre">rcParams["svg.image_inline"]</span> <span class="pre">==</span>
<span class="pre">True</span></code>, externally written images now use a single counter even if the
<code class="docutils literal notranslate"><span class="pre">renderer.basename</span></code> attribute is overwritten, rather than a counter per
basename.</p>
<p>This change will only affect you if you used <code class="docutils literal notranslate"><span class="pre">rcParams["svg.image_inline"]</span> <span class="pre">=</span> <span class="pre">True</span></code>
(the default is False) <em>and</em> manually modified <code class="docutils literal notranslate"><span class="pre">renderer.basename</span></code>.</p>
<p>Changed the default value of <code class="docutils literal notranslate"><a class="reference external" href="../../../tutorials/introductory/customizing.html?highlight=axes.formatter.limits#a-sample-matplotlibrc-file"><span class="pre">rcParams["axes.formatter.limits"]</span></a></code> (default: [-5, 6]) from -7, 7 to -5, 6
for better readability.</p>
</div>
<div class="section" id="add-subplot">
<h2><code class="docutils literal notranslate"><span class="pre">add_subplot()</span></code><a class="headerlink" href="#add-subplot" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="../../_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.add_subplot" title="matplotlib.figure.Figure.add_subplot"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Figure.add_subplot()</span></code></a> and <a class="reference internal" href="../../_as_gen/matplotlib.pyplot.subplot.html#matplotlib.pyplot.subplot" title="matplotlib.pyplot.subplot"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pyplot.subplot()</span></code></a> do not accept a <code class="xref py py-obj docutils literal notranslate"><span class="pre">figure</span></code>
keyword argument anymore. It only used to work anyway if the passed figure
was <code class="docutils literal notranslate"><span class="pre">self</span></code> or the current figure, respectively.</p>
</div>
<div class="section" id="indicate-inset">
<h2><code class="docutils literal notranslate"><span class="pre">indicate_inset()</span></code><a class="headerlink" href="#indicate-inset" title="Permalink to this headline">¶</a></h2>
<p>In <= 3.1.0, <a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.indicate_inset.html#matplotlib.axes.Axes.indicate_inset" title="matplotlib.axes.Axes.indicate_inset"><code class="xref py py-obj docutils literal notranslate"><span class="pre">indicate_inset</span></code></a> and
<a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.indicate_inset_zoom.html#matplotlib.axes.Axes.indicate_inset_zoom" title="matplotlib.axes.Axes.indicate_inset_zoom"><code class="xref py py-obj docutils literal notranslate"><span class="pre">indicate_inset_zoom</span></code></a> were documented as returning
a 4-tuple of <a class="reference internal" href="../../_as_gen/matplotlib.patches.ConnectionPatch.html#matplotlib.patches.ConnectionPatch" title="matplotlib.patches.ConnectionPatch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ConnectionPatch</span></code></a>, where in fact they
returned a 4-length list.</p>
<p>They now correctly return a 4-tuple.
<a class="reference internal" href="../../_as_gen/matplotlib.axes.Axes.indicate_inset.html#matplotlib.axes.Axes.indicate_inset" title="matplotlib.axes.Axes.indicate_inset"><code class="xref py py-obj docutils literal notranslate"><span class="pre">indicate_inset</span></code></a> would previously raise an error if
the optional <em>inset_ax</em> was not supplied; it now completes successfully,
and returns <em>None</em> instead of the tuple of <code class="docutils literal notranslate"><span class="pre">ConnectionPatch</span></code>.</p>
</div>
<div class="section" id="pgf-backend">
<h2>PGF backend<a class="headerlink" href="#pgf-backend" title="Permalink to this headline">¶</a></h2>
<p>The pgf backend's get_canvas_width_height now returns the canvas size in
display units rather than in inches, which it previously did.
The new behavior is the correct one given the uses of <code class="docutils literal notranslate"><span class="pre">get_canvas_width_height</span></code>
in the rest of the codebase.</p>
<p>The pgf backend now includes images using <code class="docutils literal notranslate"><span class="pre">\includegraphics</span></code> instead of
<code class="docutils literal notranslate"><span class="pre">\pgfimage</span></code> if the version of <code class="docutils literal notranslate"><span class="pre">graphicx</span></code> is recent enough to support the
<code class="docutils literal notranslate"><span class="pre">interpolate</span></code> option (this is detected automatically).</p>
</div>
<div class="section" id="cbook">
<h2><a class="reference internal" href="../../cbook_api.html#module-matplotlib.cbook" title="matplotlib.cbook"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cbook</span></code></a><a class="headerlink" href="#cbook" title="Permalink to this headline">¶</a></h2>
<p>The default value of the "obj_type" parameter to <code class="docutils literal notranslate"><span class="pre">cbook.warn_deprecated</span></code> has
been changed from "attribute" (a default that was never used internally) to the
empty string.</p>
</div>
<div class="section" id="testing">
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
<p>The test suite no longer turns on the Python fault handler by default.
Set the standard <code class="docutils literal notranslate"><span class="pre">PYTHONFAULTHANDLER</span></code> environment variable to do so.</p>
</div>
<div class="section" id="backend-supports-blit">
<h2>Backend <code class="docutils literal notranslate"><span class="pre">supports_blit</span></code><a class="headerlink" href="#backend-supports-blit" title="Permalink to this headline">¶</a></h2>
<p>Backends do not need to explicitly define the flag <code class="docutils literal notranslate"><span class="pre">supports_blit</span></code> anymore.
This is only relevant for backend developers. Backends had to define the flag
<code class="docutils literal notranslate"><span class="pre">supports_blit</span></code>. This is not needed anymore because the blitting capability
is now automatically detected.</p>
</div>
<div class="section" id="exception-changes">
<h2>Exception changes<a class="headerlink" href="#exception-changes" title="Permalink to this headline">¶</a></h2>
<p>Various APIs that raised a <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.8)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ValueError</span></code></a> for incorrectly typed inputs now raise
<a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.8)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TypeError</span></code></a> instead: <code class="xref py py-obj docutils literal notranslate"><span class="pre">backend_bases.GraphicsContextBase.set_clip_path</span></code>,
<code class="xref py py-obj docutils literal notranslate"><span class="pre">blocking_input.BlockingInput.__call__</span></code>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">cm.register_cmap</span></code>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">dviread.DviFont</span></code>,
<code class="xref py py-obj docutils literal notranslate"><span class="pre">rcsetup.validate_hatch</span></code>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">rcsetup.validate_animation_writer_path</span></code>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">spines.Spine</span></code>,
many classes in the <a class="reference internal" href="../../transformations.html#module-matplotlib.transforms" title="matplotlib.transforms"><code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib.transforms</span></code></a> module and <a class="reference internal" href="../../tri_api.html#module-matplotlib.tri" title="matplotlib.tri"><code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib.tri</span></code></a>
package, and Axes methods that take a <code class="docutils literal notranslate"><span class="pre">norm</span></code> parameter.</p>
<p>If extra kwargs are passed to <a class="reference internal" href="../../scale_api.html#matplotlib.scale.LogScale" title="matplotlib.scale.LogScale"><code class="xref py py-obj docutils literal notranslate"><span class="pre">LogScale</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.8)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TypeError</span></code></a> will now be
raised instead of <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.8)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ValueError</span></code></a>.</p>
</div>
<div class="section" id="mplot3d-auto-registration">
<h2>mplot3d auto-registration<a class="headerlink" href="#mplot3d-auto-registration" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="../../toolkits/mplot3d.html#module-mpl_toolkits.mplot3d" title="mpl_toolkits.mplot3d"><code class="xref py py-obj docutils literal notranslate"><span class="pre">mpl_toolkits.mplot3d</span></code></a> is always registered by default now. It is no
longer necessary to import mplot3d to create 3d axes with</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">,</span> <span class="n">projection</span><span class="o">=</span><span class="s2">"3d"</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="symlognorm-now-has-a-base-parameter">
<h2><a class="reference internal" href="../../_as_gen/matplotlib.colors.SymLogNorm.html#matplotlib.colors.SymLogNorm" title="matplotlib.colors.SymLogNorm"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SymLogNorm</span></code></a> now has a <em>base</em> parameter<a class="headerlink" href="#symlognorm-now-has-a-base-parameter" title="Permalink to this headline">¶</a></h2>
<p>Previously, <a class="reference internal" href="../../_as_gen/matplotlib.colors.SymLogNorm.html#matplotlib.colors.SymLogNorm" title="matplotlib.colors.SymLogNorm"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SymLogNorm</span></code></a> had no <em>base</em> keyword argument and the base was
hard-coded to <code class="docutils literal notranslate"><span class="pre">base=np.e</span></code>. This was inconsistent with the default behavior of
<a class="reference internal" href="../../scale_api.html#matplotlib.scale.SymmetricalLogScale" title="matplotlib.scale.SymmetricalLogScale"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SymmetricalLogScale</span></code></a> (which defaults to <code class="docutils literal notranslate"><span class="pre">base=10</span></code>) and the use of the word
"decade" in the documentation.</p>
<p>In preparation for changing the default base to 10, calling <a class="reference internal" href="../../_as_gen/matplotlib.colors.SymLogNorm.html#matplotlib.colors.SymLogNorm" title="matplotlib.colors.SymLogNorm"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SymLogNorm</span></code></a>
without the new <em>base</em> keyword argument emits a deprecation warning.</p>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<footer>
<div class="footer">
© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2018 The Matplotlib development team.
<br />
Last updated on Apr 08, 2020.
Created using
<a href="http://sphinx-doc.org/">Sphinx</a> 3.0.0.
Doc version v3.2.1-13-g7a9bc5ebb-dirty.
</div>
</footer>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55954603-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>