API Changes in 2.2.0#
kiwisolver is now a required dependency to support the new constrained_layout, see Constrained Layout Guide for more details.
Classes, functions, and methods#
The unused and untested
Artist.hitlist methods have
The now unused
mlab.less_simple_linear_interpolation function is
ContourLabeler.get_real_label_width method is deprecated.
FigureManagerBase.show_popup method is deprecated. This
introduced in e945059b327d42a99938b939a1be867fa023e7ba in 2005 but never built
out into any of the backends.
backend_tkagg.AxisMenu is deprecated, as it has become unused since the
removal of "classic" toolbars.
Changed function signatures#
pyplot.axes with an
Axes as argument is deprecated. This sets
the current axes, i.e. it has the same effect as
pyplot.sca. For clarity
plt.sca(ax) should be preferred over
Using strings instead of booleans to control grid and tick visibility
is deprecated. Using
to control grid and tick visibility has been deprecated. Instead, use
normal booleans (
False) or boolean-likes. In the future,
all non-empty strings may be interpreted as
When given 2D inputs with non-matching numbers of columns,
currently cycles through the columns of the narrower input, until all the
columns of the wider input have been plotted. This behavior is deprecated; in
the future, only broadcasting (1 column to n columns) will be performed.
rcParams["backend.qt5"] rcParams were deprecated
in version 2.2. In order to force the use of a specific Qt binding,
either import that binding first, or set the
Deprecation of the
nbagg.transparent rcParam. To control
transparency of figure patches in the nbagg (or any other) backend,
figure.patch.facecolor, or the
Axis.units (which has long existed) instead.
Contouring no longer supports
legacy corner masking. The
ContourSet.vmax properties have
None instead of
"none" as format to
errorbar is no
bgcolor keyword argument to
Axes has been removed.
Modules, methods, and functions#
mpl_toolkits.gtktools modules have been removed.
remains available at matplotlib/mpl_finance.
mpl_toolkits.mplot3d.art3d.iscolor function has been removed.
MaxNLocator.bin_boundaries methods have been removed.
mencoder can no longer be used to encode animations.
fontd attributes of the
class have been removed.
spectral colormap has been removed. The
Vega* colormaps, which
were aliases for the
tab* colormaps, have been removed.
The following deprecated rcParams have been removed:
Only accept string-like for Categorical input#
Do not accept mixed string / float / int input, only strings are valid categoricals.
Removal of unused imports#
Many unused imports were removed from the codebase. As a result,
trying to import certain classes or functions from the "wrong" module
matplotlib.backends.backend_agg instead of
matplotlib.figure) will now raise an
get_zlim now return a tuple#
They previously returned an array. Returning a tuple is consistent with the behavior for 2D axes.
Exception type changes#
MovieWriterRegistry can't find the requested
RuntimeError message is now raised instead of the
matplotlib.tight_layout.auto_adjust_subplotpars now raises
RuntimeError when sizes of input lists don't match
Figure.set_figheight default forward to True#
matplotlib.figure.Figure.set_figheight had the keyword argument
forward=False by default, but
figure.Figure.set_size_inches now defaults
forward=True. This makes these functions consistent.
Do not truncate svg sizes to nearest point#
There is no reason to size the SVG out put in integer points, change to out putting floats for the height, width, and viewBox attributes of the svg element.
Fontsizes less than 1 pt are clipped to be 1 pt.#
FreeType doesn't allow fonts to get smaller than 1 pt, so all Agg backends were silently rounding up to 1 pt. PDF (other vector backends?) were letting us write fonts that were less than 1 pt, but they could not be placed properly because position information comes from FreeType. This change makes it so no backends can use fonts smaller than 1 pt, consistent with FreeType and ensuring more consistent results across backends.
Changes to Qt backend class MRO#
To support both Agg and cairo rendering for Qt backends all of the non-Agg
specific code previously in
backend_qt5agg.FigureCanvasQTAggBase has been
backend_qt5.FigureCanvasQT so it can be shared with the
cairo implementation. The
methods have moved to
The first two methods assume that the instance is also a
QWidget so to use
FigureCanvasQTAggBase it was required to multiple inherit from a
Having moved all of its methods either up or down the class hierarchy
FigureCanvasQTAggBase has been deprecated. To do this without warning and
to preserve as much API as possible,
now inherits from
The MRO for
FigureCanvasQTAggBase used to
[matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg, matplotlib.backends.backend_qt5agg.FigureCanvasQTAggBase, matplotlib.backends.backend_agg.FigureCanvasAgg, matplotlib.backends.backend_qt5.FigureCanvasQT, PyQt5.QtWidgets.QWidget, PyQt5.QtCore.QObject, sip.wrapper, PyQt5.QtGui.QPaintDevice, sip.simplewrapper, matplotlib.backend_bases.FigureCanvasBase, object]
[matplotlib.backends.backend_qt5agg.FigureCanvasQTAggBase, matplotlib.backends.backend_agg.FigureCanvasAgg, matplotlib.backend_bases.FigureCanvasBase, object]
respectively. They are now
[matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg, matplotlib.backends.backend_agg.FigureCanvasAgg, matplotlib.backends.backend_qt5.FigureCanvasQT, PyQt5.QtWidgets.QWidget, PyQt5.QtCore.QObject, sip.wrapper, PyQt5.QtGui.QPaintDevice, sip.simplewrapper, matplotlib.backend_bases.FigureCanvasBase, object]
[matplotlib.backends.backend_qt5agg.FigureCanvasQTAggBase, matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg, matplotlib.backends.backend_agg.FigureCanvasAgg, matplotlib.backends.backend_qt5.FigureCanvasQT, PyQt5.QtWidgets.QWidget, PyQt5.QtCore.QObject, sip.wrapper, PyQt5.QtGui.QPaintDevice, sip.simplewrapper, matplotlib.backend_bases.FigureCanvasBase, object]
axes.Axes.imshow clips RGB values to the valid range#
axes.Axes.imshow is passed an RGB or RGBA value with out-of-range
values, it now logs a warning and clips them to the valid range.
The old behaviour, wrapping back in to the range, often hid outliers
and made interpreting RGB images unreliable.
GTKAgg and GTKCairo backends deprecated#
The GTKAgg and GTKCairo backends have been deprecated. These obsolete backends
allow figures to be rendered via the GTK+ 2 toolkit. They are untested, known
to be broken, will not work with Python 3, and their use has been discouraged
for some time. Instead, use the
GTK3Cairo backends for
rendering to GTK+ 3 windows.