File: deprecations.rst

package info (click to toggle)
matplotlib 3.10.1%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,340 kB
  • sloc: python: 147,118; cpp: 62,988; objc: 1,679; ansic: 1,426; javascript: 786; makefile: 92; sh: 53
file content (304 lines) | stat: -rw-r--r-- 11,290 bytes parent folder | download | duplicates (3)
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

Deprecations
------------

`matplotlib.use`
~~~~~~~~~~~~~~~~
The ``warn`` parameter to `matplotlib.use()` is deprecated (catch the
`ImportError` emitted on backend switch failure and reemit a warning yourself
if so desired).

plotfile
~~~~~~~~
``.pyplot.plotfile`` is deprecated in favor of separately loading and plotting
the data.  Use pandas or NumPy to load data, and pandas or matplotlib to plot
the resulting data.

axes and axis
~~~~~~~~~~~~~
Setting ``Axis.major.locator``, ``Axis.minor.locator``, ``Axis.major.formatter``
or ``Axis.minor.formatter`` to an object that is not a subclass of `.Locator` or
`.Formatter` (respectively) is deprecated.  Note that these attributes should
usually be set using `.Axis.set_major_locator`, `.Axis.set_minor_locator`, etc.
which already raise an exception when an object of the wrong class is passed.

Passing more than one positional argument or unsupported keyword arguments to
`~matplotlib.axes.Axes.axis()` is deprecated (such arguments used to be
silently ignored).

``minor`` argument will become keyword-only
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using the parameter ``minor`` to ``get_*ticks()`` / ``set_*ticks()`` as a
positional parameter is deprecated. It will become keyword-only in future
versions.

``axes_grid1``
~~~~~~~~~~~~~~
The ``mpl_toolkits.axes_grid1.colorbar`` module and its colorbar implementation
are deprecated in favor of :mod:`matplotlib.colorbar`, as the former is
essentially abandoned and the latter is a more featureful replacement with a
nearly compatible API (for example, the following additional keywords are
supported: ``panchor``, ``extendfrac``, ``extendrect``).

The main differences are:

- Setting the ticks on the colorbar is done by calling ``colorbar.set_ticks``
  rather than ``colorbar.cbar_axis.set_xticks`` or
  ``colorbar.cbar_axis.set_yticks``; the ``locator`` parameter to ``colorbar()``
  is deprecated in favor of its synonym ``ticks`` (which already existed
  previously, and is consistent with :mod:`matplotlib.colorbar`).
- The colorbar's long axis is accessed with ``colorbar.xaxis`` or
  ``colorbar.yaxis`` depending on the orientation, rather than
  ``colorbar.cbar_axis``.
- The default ticker is no longer ``MaxNLocator(5)``, but a
  ``_ColorbarAutoLocator``.
- Overdrawing multiple colorbars on top of one another in a single Axes (e.g.
  when using the ``cax`` attribute of `~.axes_grid1.axes_grid.ImageGrid`
  elements) is not supported; if you previously relied on the second colorbar
  being drawn over the first, you can call ``cax.cla()`` to clear the axes
  before drawing the second colorbar.

During the deprecation period, the ``mpl_toolkits.legacy_colorbar``
rcParam can be set to True to use ``mpl_toolkits.axes_grid1.colorbar`` in
:mod:`mpl_toolkits.axes_grid1` code with a deprecation warning (the default),
or to False to use ``matplotlib.colorbar``.

Passing a ``pad`` size of ``None`` (the default) as a synonym for zero to
the ``append_axes``, ``new_horizontal`` and ``new_vertical`` methods of
`.axes_grid1.axes_divider.AxesDivider` is deprecated.  In a future release, the
default value of ``None`` will mean "use :rc:`figure.subplot.wspace` or
:rc:`figure.subplot.hspace`" (depending on the orientation).  Explicitly pass
``pad=0`` to keep the old behavior.

Axes3D
~~~~~~
``mplot3d.axis3d.get_flip_min_max`` is deprecated.

``axes3d.unit_bbox`` is deprecated (use ``Bbox.unit`` instead).

``axes3d.Axes3D.w_xaxis``, ``.w_yaxis``, and ``.w_zaxis`` are deprecated (use
``.xaxis``, ``.yaxis``, and ``.zaxis`` instead).

`matplotlib.cm`
~~~~~~~~~~~~~~~
``cm.revcmap`` is deprecated.  Use `.Colormap.reversed` to reverse a colormap.

``cm.datad`` no longer contains entries for reversed colormaps in their
"unconverted" form.

axisartist
~~~~~~~~~~
``mpl_toolkits.axisartist.grid_finder.GridFinderBase`` is deprecated (its
only use is to be inherited by the `.GridFinder` class which just provides
more defaults in the constructor and directly sets the transforms, so
``GridFinderBase``'s methods were just moved to `.GridFinder`).

``axisartist.axis_artist.BezierPath`` is deprecated (use `.patches.PathPatch`
to draw arbitrary Paths).

``AxisArtist.line`` is now a `.patches.PathPatch` instance instead of a
``BezierPath`` instance.

Returning a factor equal to None from axisartist Locators (which are **not**
the same as "standard" tick Locators), or passing a factor equal to None
to axisartist Formatters (which are **not** the same as "standard" tick
Formatters) is deprecated.  Pass a factor equal to 1 instead.

For the `mpl_toolkits.axisartist.axis_artist.AttributeCopier` class, the
constructor and the ``set_ref_artist`` method, and the *default_value*
parameter of ``get_attribute_from_ref_artist``, are deprecated.

Deprecation of the constructor means that classes inheriting from
`.AttributeCopier` should no longer call its constructor.

Locators
~~~~~~~~
The unused ``Locator.autoscale`` method is deprecated (pass the axis limits to
`.Locator.view_limits` instead).

Animation
~~~~~~~~~
The following methods and attributes of the `.MovieWriterRegistry` class are
deprecated: ``set_dirty``, ``ensure_not_dirty``, ``reset_available_writers``,
``avail``.

``smart_bounds()``
~~~~~~~~~~~~~~~~~~
The "smart_bounds" functionality is deprecated.  This includes
``Axis.set_smart_bounds()``, ``Axis.get_smart_bounds()``,
``Spine.set_smart_bounds()``, and ``Spine.get_smart_bounds()``.

``boxplot()``
~~~~~~~~~~~~~
Setting the ``whis`` parameter of `.Axes.boxplot` and `.cbook.boxplot_stats` to
"range" to mean "the whole data range" is deprecated; set it to (0, 100) (which
gets interpreted as percentiles) to achieve the same effect.

``fill_between()``
~~~~~~~~~~~~~~~~~~
Passing scalars to parameter *where* in ``fill_between()`` and
``fill_betweenx()`` is deprecated. While the documentation already states that
*where* must be of the same size as *x* (or *y*), scalars were accepted and
broadcasted to the size of *x*. Non-matching sizes will raise a ``ValueError``
in the future.

``scatter()``
~~~~~~~~~~~~~
Passing the *verts* parameter to `.axes.Axes.scatter` is deprecated; use the
*marker* parameter instead.

``tight_layout()``
~~~~~~~~~~~~~~~~~~
The ``renderer`` parameter to `.Figure.tight_layout` is deprecated; this method
now always uses the renderer instance cached on the `.Figure`.

rcParams
~~~~~~~~
The ``rcsetup.validate_animation_writer_path`` function is deprecated.

Setting :rc:`savefig.format` to "auto" is deprecated; use its synonym "png" instead.

Setting :rc:`text.hinting` to True or False is deprecated; use their synonyms
"auto" or "none" instead.

``rcsetup.update_savefig_format`` is deprecated.

``rcsetup.validate_path_exists`` is deprecated (use ``os.path.exists`` to check
whether a path exists).

``rcsetup.ValidateInterval`` is deprecated.

Dates
~~~~~
``dates.mx2num`` is deprecated.

TK
~~
``NavigationToolbar2Tk.set_active`` is deprecated, as it has no (observable)
effect.

WX
~~
``FigureFrameWx.statusbar`` and ``NavigationToolbar2Wx.statbar`` are deprecated.
The status bar can be retrieved by calling standard wx methods
(``frame.GetStatusBar()`` and ``toolbar.GetTopLevelParent().GetStatusBar()``).

``backend_wx.ConfigureSubplotsWx.configure_subplots`` and
``backend_wx.ConfigureSubplotsWx.get_canvas`` are deprecated.

PGF
~~~
``backend_pgf.repl_escapetext`` and ``backend_pgf.repl_mathdefault`` are
deprecated.

``RendererPgf.latexManager`` is deprecated.

FigureCanvas
~~~~~~~~~~~~
``FigureCanvasBase.draw_cursor`` (which has never done anything and has never
been overridden in any backend) is deprecated.

``FigureCanvasMac.invalidate`` is deprecated in favor of its synonym,
``FigureCanvasMac.draw_idle``.

The ``dryrun`` parameter to the various ``FigureCanvasFoo.print_foo`` methods
is deprecated.


QuiverKey doc
~~~~~~~~~~~~~
``quiver.QuiverKey.quiverkey_doc`` is deprecated; use
``quiver.QuiverKey.__init__.__doc__`` instead.

`matplotlib.mlab`
~~~~~~~~~~~~~~~~~
``mlab.apply_window`` and ``mlab.stride_repeat`` are deprecated.

Fonts
~~~~~
``font_manager.JSONEncoder`` is deprecated.  Use `.font_manager.json_dump` to
dump a `.FontManager` instance.

``font_manager.createFontList`` is deprecated.  `.font_manager.FontManager.addfont`
is now available to register a font at a given path.

The ``as_str``, ``as_rgba_str``, ``as_array``, ``get_width`` and ``get_height``
methods of ``matplotlib.ft2font.FT2Image`` are deprecated.  Convert the ``FT2Image``
to a NumPy array with ``np.asarray`` before processing it.

Colors
~~~~~~
The function ``matplotlib.colors.makeMappingArray`` is not considered part of
the public API any longer. Thus, it's deprecated.

Using a string of single-character colors as a color sequence (e.g. "rgb") is
deprecated. Use an explicit list instead.

Scales
~~~~~~
Passing unsupported keyword arguments to `.ScaleBase`, and its subclasses
`.LinearScale` and `.SymmetricalLogScale`, is deprecated and will raise a
`TypeError` in 3.3.

If extra keyword arguments are passed to `.LogScale`, `TypeError` will now be
raised instead of `ValueError`.

Testing
~~~~~~~
The ``matplotlib.testing.disable_internet`` module is deprecated.  Use (for
example) pytest-remotedata_ instead.

.. _pytest-remotedata: https://pypi.org/project/pytest-remotedata/

Support in `matplotlib.testing` for nose-based tests is deprecated (a
deprecation is emitted if using e.g. the decorators from that module while
both 1) matplotlib's conftests have not been called and 2) nose is in
``sys.modules``).

``testing.is_called_from_pytest`` is deprecated.

During the deprecation period, to force the generation of nose base tests,
import nose first.

The *switch_backend_warn* parameter to ``matplotlib.test`` has no effect and is
deprecated.

``testing.jpl_units.UnitDbl.UnitDbl.checkUnits`` is deprecated.

``DivergingNorm`` renamed to ``TwoSlopeNorm``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``DivergingNorm`` was a misleading name; although the norm was
developed with the idea that it would likely be used with diverging
colormaps, the word 'diverging' does not describe or evoke the norm's
mapping function.  Since that function is monotonic, continuous, and
piece-wise linear with two segments, the norm has been renamed to
`.TwoSlopeNorm`

Misc
~~~~
``matplotlib.get_home`` is deprecated (use e.g. ``os.path.expanduser("~")``)
instead.

``matplotlib.compare_versions`` is deprecated (use comparison of
``distutils.version.LooseVersion``\s instead).

``matplotlib.checkdep_ps_distiller`` is deprecated.

``matplotlib.figure.AxesStack`` is considered private API and will be removed
from the public API in future versions.

``BboxBase.is_unit`` is deprecated (check the Bbox extents if needed).

``Affine2DBase.matrix_from_values(...)`` is deprecated.  Use (for example)
``Affine2D.from_values(...).get_matrix()`` instead.

``style.core.is_style_file`` and ``style.core.iter_style_files``
are deprecated.

The ``datapath`` rcParam
~~~~~~~~~~~~~~~~~~~~~~~~
Use `.get_data_path` instead.  (The rcParam is deprecated because it cannot be
meaningfully set by an end user.)  The rcParam had no effect from 3.2.0, but
was deprecated only in 3.2.1.  In 3.2.1+ if ``'datapath'`` is set in a
``matplotlibrc`` file it will be respected, but this behavior will be removed in 3.3.