API Changes for 3.6.0#
Behaviour changes#
plt.get_cmap and matplotlib.cm.get_cmap return a copy#
Formerly, get_cmap and matplotlib.cm.get_cmap returned a global version
of a Colormap. This was prone to errors as modification of the colormap would
propagate from one location to another without warning. Now, a new copy of the colormap
is returned.
Large imshow images are now downsampled#
When showing an image using imshow that has more than
\(2^{24}\) columns or \(2^{23}\) rows, the image will now be
downsampled to below this resolution before being resampled for display by the
AGG renderer. Previously such a large image would be shown incorrectly. To
prevent this downsampling and the warning it raises, manually downsample your
data before handing it to imshow.
Default date limits changed to 1970-01-01 – 1970-01-02#
Previously the default limits for an empty axis set up for dates
(Axis.axis_date) was 2000-01-01 to 2010-01-01. This has been changed to
1970-01-01 to 1970-01-02. With the default epoch, this makes the numeric limit
for date axes the same as for other axes (0.0-1.0), and users are less likely
to set a locator with far too many ticks.
markerfmt argument to stem#
The behavior of the markerfmt parameter of stem has changed:
If markerfmt does not contain a color, the color is taken from linefmt.
If markerfmt does not contain a marker, the default is 'o'.
Before, markerfmt was passed unmodified to plot(..., fmt), which had a
number of unintended side-effects; e.g. only giving a color switched to a solid
line without markers.
For a simple call stem(x, y) without parameters, the new rules still
reproduce the old behavior.
get_ticklabels now always populates labels#
Previously Axis.get_ticklabels (and Axes.get_xticklabels,
Axes.get_yticklabels) would only return empty strings unless a draw had
already been performed. Now the ticks and their labels are updated when the
labels are requested.
Warning when scatter plot color settings discarded#
When making an animation of a scatter plot, if you don't set c (the color
value parameter) when initializing the artist, the color settings are ignored.
Axes.scatter now raises a warning if color-related settings are changed
without setting c.
3D contourf polygons placed between levels#
The polygons used in a 3D contourf plot are now placed halfway
between the contour levels, as each polygon represents the location of values
that lie between two levels.
Axes title now avoids y-axis offset#
Previously, Axes titles could overlap the y-axis offset text, which is often in
the upper left corner of the axes. Now titles are moved above the offset text
if overlapping when automatic title positioning is in effect (i.e. if y in
Axes.set_title is None and rcParams["axes.titley"] (default: None) is also None).
Dotted operators gain extra space in mathtext#
In mathtext, \doteq \doteqdot \dotminus \dotplus \dots are now surrounded
by extra space because they are correctly treated as relational or binary
operators.
math parameter of mathtext.get_unicode_index defaults to False#
In math mode, ASCII hyphens (U+002D) are now replaced by Unicode minus signs (U+2212) at the parsing stage.
ArtistList proxies copy contents on iteration#
When iterating over the contents of the dynamically generated proxy lists for the Artist-type accessors (see Axes children are no longer separated by type), a copy of the contents is made. This ensure that artists can safely be added or removed from the Axes while iterating over their children.
This is a departure from the expected behavior of mutable iterable data types in Python — iterating over a list while mutating it has surprising consequences and dictionaries will error if they change size during iteration. Because all of the accessors are filtered views of the same underlying list, it is possible for seemingly unrelated changes, such as removing a Line, to affect the iteration over any of the other accessors. In this case, we have opted to make a copy of the relevant children before yielding them to the user.
This change is also consistent with our plan to make these accessors immutable in Matplotlib 3.7.
AxesImage string representation#
The string representation of AxesImage changes from stating the position in
the figure "AxesImage(80,52.8;496x369.6)" to giving the number of pixels
"AxesImage(size=(300, 200))".
Improved autoscaling for Bézier curves#
Bézier curves are now autoscaled to their extents - previously they were autoscaled to their ends and control points, which in some cases led to unnecessarily large limits.
QuadMesh mouseover defaults to False#
New in 3.5, QuadMesh.get_cursor_data allows display of data values under the
cursor. However, this can be very slow for large meshes, so mouseover now
defaults to False.
Changed pgf backend document class#
The pgf backend now uses the article document class as basis for
compilation.
MathtextBackendAgg.get_results no longer returns used_characters#
The last item (used_characters) in the tuple returned by
MathtextBackendAgg.get_results has been removed. In order to unpack this
tuple in a backward and forward-compatible way, use e.g. ox, oy, width,
height, descent, image, *_ = parse(...), which will ignore
used_characters if it was present.
Type1Font objects include more properties#
The matplotlib._type1font.Type1Font.prop dictionary now includes more keys,
such as CharStrings and Subrs. The value of the Encoding key is now
a dictionary mapping codes to glyph names. The
matplotlib._type1font.Type1Font.transform method now correctly removes
UniqueID properties from the font.
rcParams.copy() returns RcParams rather than dict#
Returning an RcParams instance from RcParams.copy makes the copy still
validate inputs, and additionally avoids emitting deprecation warnings when
using a previously copied instance to update the global instance (even if some
entries are deprecated).
rc_context no longer resets the value of 'backend'#
matplotlib.rc_context incorrectly reset the value of rcParams["backend"] if backend
resolution was triggered in the context. This affected only the value. The
actual backend was not changed. Now, matplotlib.rc_context does not reset
rcParams["backend"] anymore.
Default rcParams["animation.convert_args"] changed#
It now defaults to ["-layers", "OptimizePlus"] to try to generate smaller
GIFs. Set it back to an empty list to recover the previous behavior.
Style file encoding now specified to be UTF-8#
It has been impossible to import Matplotlib with a non UTF-8 compatible locale encoding because we read the style library at import time. This change is formalizing and documenting the status quo so there is no deprecation period.
MacOSX backend uses sRGB instead of GenericRGB color space#
MacOSX backend now display sRGB tagged image instead of GenericRGB which is an older (now deprecated) Apple color space. This is the source color space used by ColorSync to convert to the current display profile.
Renderer optional for get_tightbbox and get_window_extent#
The Artist.get_tightbbox and Artist.get_window_extent methods no longer
require the renderer keyword argument, saving users from having to query it
from fig.canvas.get_renderer. If the renderer keyword argument is not
supplied, these methods first check if there is a cached renderer from a
previous draw and use that. If there is no cached renderer, then the methods
will use fig.canvas.get_renderer() as a fallback.
FigureFrameWx constructor, subclasses, and get_canvas#
The FigureCanvasWx constructor gained a canvas_class keyword-only
parameter which specifies the canvas class that should be used. This parameter
will become required in the future. The get_canvas method, which was
previously used to customize canvas creation, is deprecated. The
FigureFrameWxAgg and FigureFrameWxCairo subclasses, which overrode
get_canvas, are deprecated.
FigureFrameWx.sizer#
... has been removed. The frame layout is no longer based on a sizer, as the
canvas is now the sole child widget; the toolbar is now a regular toolbar added
using SetToolBar.
Incompatible layout engines raise#
You cannot switch between tight_layout and constrained_layout if a
colorbar has already been added to a figure. Invoking the incompatible layout
engine used to warn, but now raises with a RuntimeError.
CallbackRegistry raises on unknown signals#
When Matplotlib instantiates a CallbackRegistry, it now limits callbacks to
the signals that the registry knows about. In practice, this means that calling
mpl_connect with an invalid signal name now raises a
ValueError.
Changed exception type for incorrect SVG date metadata#
Providing date metadata with incorrect type to the SVG backend earlier resulted
in a ValueError. Now, a TypeError is raised instead.
Specified exception types in Grid#
In a few cases an Exception was thrown when an incorrect argument value was
set in the mpl_toolkits.axes_grid1.axes_grid.Grid (=
mpl_toolkits.axisartist.axes_grid.Grid) constructor. These are replaced as
follows:
Providing an incorrect value for ngrids now raises a
ValueErrorProviding an incorrect type for rect now raises a
TypeError
Deprecations#
Parameters to plt.figure() and the Figure constructor#
All parameters to pyplot.figure and the Figure constructor, other than
num, figsize, and dpi, will become keyword-only after a deprecation
period.
Deprecation aliases in cbook#
The module matplotlib.cbook.deprecation was previously deprecated in
Matplotlib 3.4, along with deprecation-related API in matplotlib.cbook. Due
to technical issues, matplotlib.cbook.MatplotlibDeprecationWarning and
matplotlib.cbook.mplDeprecation did not raise deprecation warnings on use.
Changes in Python have now made it possible to warn when these aliases are
being used.
In order to avoid downstream breakage, these aliases will now warn, and their
removal has been pushed from 3.6 to 3.8 to give time to notice said warnings.
As replacement, please use matplotlib.MatplotlibDeprecationWarning.
Axes subclasses should override clear instead of cla#
For clarity, axes.Axes.clear is now preferred over Axes.cla. However, for
backwards compatibility, the latter will remain as an alias for the former.
For additional compatibility with third-party libraries, Matplotlib will
continue to call the cla method of any Axes subclasses if they
define it. In the future, this will no longer occur, and Matplotlib will only
call the clear method in Axes subclasses.
It is recommended to define only the clear method when on Matplotlib 3.6,
and only cla for older versions.
Pending deprecation top-level cmap registration and access functions in mpl.cm#
As part of a multi-step process we are refactoring the global state for managing the registered colormaps.
In Matplotlib 3.5 we added a ColormapRegistry class and exposed an instance
at the top level as matplotlib.colormaps. The existing top level functions
in matplotlib.cm (get_cmap, register_cmap, unregister_cmap) were
changed to be aliases around the same instance.
In Matplotlib 3.6 we have marked those top level functions as pending deprecation with the intention of deprecation in Matplotlib 3.7. The following functions have been marked for pending deprecation:
matplotlib.cm.get_cmap; usematplotlib.colormaps[name]instead if you have astr.Added 3.6.1 Use
matplotlib.cm.ColormapRegistry.get_cmapif you have a string,Noneor amatplotlib.colors.Colormapobject that you want to convert to amatplotlib.colors.Colormapinstance.matplotlib.cm.register_cmap; usematplotlib.colormaps.registerinsteadmatplotlib.cm.unregister_cmap; usematplotlib.colormaps.unregisterinsteadmatplotlib.pyplot.register_cmap; usematplotlib.colormaps.registerinstead
The matplotlib.pyplot.get_cmap function will stay available for backward
compatibility.
Pending deprecation of layout methods#
The methods set_tight_layout, set_constrained_layout, are
discouraged, and now emit a PendingDeprecationWarning in favor of explicitly
referencing the layout engine via figure.set_layout_engine('tight') and
figure.set_layout_engine('constrained'). End users should not see the
warning, but library authors should adjust.
The methods set_constrained_layout_pads and
get_constrained_layout_pads are will be deprecated in favor of
figure.get_layout_engine().set() and figure.get_layout_engine().get(),
and currently emit a PendingDeprecationWarning.
seaborn styles renamed#
Matplotlib currently ships many style files inspired from the seaborn library ("seaborn", "seaborn-bright", "seaborn-colorblind", etc.) but they have gone out of sync with the library itself since the release of seaborn 0.9. To prevent confusion, the style files have been renamed "seaborn-v0_8", "seaborn-v0_8-bright", "seaborn-v0_8-colorblind", etc. Users are encouraged to directly use seaborn to access the up-to-date styles.
Auto-removal of overlapping Axes by plt.subplot and plt.subplot2grid#
Previously, pyplot.subplot and pyplot.subplot2grid would automatically
remove preexisting Axes that overlap with the newly added Axes. This behavior
was deemed confusing, and is now deprecated. Explicitly call ax.remove() on
Axes that need to be removed.
Passing linefmt positionally to stem is undeprecated#
Positional use of all formatting parameters in stem has been
deprecated since Matplotlib 3.5. This deprecation is relaxed so that one can
still pass linefmt positionally, i.e. stem(x, y, 'r').
stem(..., use_line_collection=False)#
... is deprecated with no replacement. This was a compatibility fallback to a former more inefficient representation of the stem lines.
Positional / keyword arguments#
Passing all but the very few first arguments positionally in the constructors of Artists is deprecated. Most arguments will become keyword-only in a future version.
Passing too many positional arguments to tripcolor is now deprecated (extra
arguments were previously silently ignored).
Passing emit and auto parameters of set_xlim, set_ylim,
set_zlim, set_rlim positionally is deprecated; they will become
keyword-only in a future release.
The transOffset parameter of Collection.set_offset_transform and the
various create_collection methods of legend handlers has been renamed to
offset_transform (consistently with the property name).
Calling MarkerStyle() with no arguments or MarkerStyle(None) is
deprecated; use MarkerStyle("") to construct an empty marker style.
Axes.get_window_extent / Figure.get_window_extent accept only
renderer. This aligns the API with the general Artist.get_window_extent
API. All other parameters were ignored anyway.
The cleared parameter of get_renderer, which only existed for AGG-based
backends, has been deprecated. Use renderer.clear() instead to explicitly
clear the renderer buffer.
Methods to set parameters in LogLocator and LogFormatter*#
In LogFormatter and derived subclasses, the methods base and
label_minor for setting the respective parameter are deprecated and
replaced by set_base and set_label_minor, respectively.
In LogLocator, the methods base and subs for setting the respective
parameter are deprecated. Instead, use set_params(base=..., subs=...).
Axes.get_renderer_cache#
The canvas now takes care of the renderer and whether to cache it or not. The
alternative is to call axes.figure.canvas.get_renderer().
Unused methods in Axis, Tick, XAxis, and YAxis#
Tick.label has been pending deprecation since 3.1 and is now deprecated.
Use Tick.label1 instead.
The following methods are no longer used and deprecated without a replacement:
Axis.get_ticklabel_extentsTick.get_pad_pixelsXAxis.get_text_heightsYAxis.get_text_widths
mlab.stride_windows#
... is deprecated. Use np.lib.stride_tricks.sliding_window_view instead (or
np.lib.stride_tricks.as_strided on NumPy < 1.20).
Event handlers#
The draw_event, resize_event, close_event, key_press_event,
key_release_event, pick_event, scroll_event,
button_press_event, button_release_event, motion_notify_event,
enter_notify_event and leave_notify_event methods of
FigureCanvasBase are deprecated. They had inconsistent signatures across
backends, and made it difficult to improve event metadata.
In order to trigger an event on a canvas, directly construct an Event object
of the correct class and call canvas.callbacks.process(event.name, event).
Widgets#
All parameters to MultiCursor starting from useblit are becoming
keyword-only (passing them positionally is deprecated).
The canvas and background attributes of MultiCursor are deprecated
with no replacement.
The visible attribute of Selector widgets has been deprecated; use
set_visible or get_visible instead.
The state_modifier_keys attribute of Selector widgets has been privatized and the modifier keys must be set when creating the widget.
Axes3D.dist#
... has been privatized. Use the zoom keyword argument in
Axes3D.set_box_aspect instead.
3D Axis#
The previous constructor of axis3d.Axis, with signature (self, adir,
v_intervalx, d_intervalx, axes, *args, rotate_label=None, **kwargs) is
deprecated in favor of a new signature closer to the one of 2D Axis; it is now
(self, axes, *, rotate_label=None, **kwargs) where kwargs are forwarded
to the 2D Axis constructor. The axis direction is now inferred from the axis
class' axis_name attribute (as in the 2D case); the adir attribute is
deprecated.
The init3d method of 3D Axis is also deprecated; all the relevant
initialization is done as part of the constructor.
The d_interval and v_interval attributes of 3D Axis are deprecated; use
get_data_interval and get_view_interval instead.
The w_xaxis, w_yaxis, and w_zaxis attributes of Axis3D have
been pending deprecation since 3.1. They are now deprecated. Instead use
xaxis, yaxis, and zaxis.
mplot3d.axis3d.Axis.set_pane_pos is deprecated. This is an internal method
where the provided values are overwritten during drawing. Hence, it does not
serve any purpose to be directly accessible.
The two helper functions mplot3d.axis3d.move_from_center and
mplot3d.axis3d.tick_update_position are considered internal and deprecated.
If these are required, please vendor the code from the corresponding private
methods _move_from_center and _tick_update_position.
Figure.callbacks is deprecated#
The Figure callbacks property is deprecated. The only signal was
"dpi_changed", which can be replaced by connecting to the "resize_event" on the
canvas figure.canvas.mpl_connect("resize_event", func) instead.
FigureCanvas without a required_interactive_framework attribute#
Support for such canvas classes is deprecated. Note that canvas classes which
inherit from FigureCanvasBase always have such an attribute.
Backend-specific deprecations#
backend_gtk3.FigureManagerGTK3Aggandbackend_gtk4.FigureManagerGTK4Agg; directly usebackend_gtk3.FigureManagerGTK3andbackend_gtk4.FigureManagerGTK4instead.The window parameter to
backend_gtk3.NavigationToolbar2GTK3had no effect, and is now deprecated.backend_gtk3.NavigationToolbar2GTK3.winbackend_gtk3.RendererGTK3Cairoandbackend_gtk4.RendererGTK4Cairo; useRendererCairoinstead, which has gained theset_contextmethod, which also auto-infers the size of the underlying surface.backend_cairo.RendererCairo.set_ctx_from_surfaceandbackend_cairo.RendererCairo.set_width_heightin favor ofRendererCairo.set_context.backend_gtk3.error_msg_gtkbackend_gtk3.icon_filenameandbackend_gtk3.window_iconbackend_macosx.NavigationToolbar2Mac.prepare_configure_subplotshas been replaced byconfigure_subplots().backend_pdf.Name.hexifybackend_pdf.Operatorandbackend_pdf.Op.opare deprecated in favor of a single standardenum.Enuminterface onbackend_pdf.Op.backend_pdf.fill; vendor the code of the similarly named private functions if you rely on these functions.backend_pgf.LatexManager.texcommandandbackend_pgf.LatexManager.latex_headerbackend_pgf.NO_ESCAPEbackend_pgf.common_texificationbackend_pgf.get_fontspecbackend_pgf.get_preamblebackend_pgf.re_mathsepbackend_pgf.writelnbackend_ps.convert_psfragsbackend_ps.quote_ps_string; vendor the code of the similarly named private functions if you rely on it.backend_qt.qApp; useQtWidgets.QApplication.instance()instead.backend_svg.escape_attrib; vendor the code of the similarly named private functions if you rely on it.backend_svg.escape_cdata; vendor the code of the similarly named private functions if you rely on it.backend_svg.escape_comment; vendor the code of the similarly named private functions if you rely on it.backend_svg.short_float_fmt; vendor the code of the similarly named private functions if you rely on it.backend_svg.generate_transformandbackend_svg.generate_cssbackend_tk.NavigationToolbar2Tk.lastrectandbackend_tk.RubberbandTk.lastrectbackend_tk.NavigationToolbar2Tk.window; usetoolbar.masterinstead.backend_tools.ToolBase.destroy; To run code upon tool removal, connect to thetool_removed_eventevent.backend_wx.RendererWx.offset_text_heightbackend_wx.error_msg_wxFigureCanvasBase.pick; directly callFigure.pick, which has taken over the responsibility of checking the canvas widget lock as well.FigureCanvasBase.resize, which has no effect; useFigureManagerBase.resizeinstead.FigureManagerMac.closeFigureFrameWx.sizer; useframe.GetSizer()instead.FigureFrameWx.figmgrandFigureFrameWx.get_figure_manager; useframe.canvas.managerinstead.FigureFrameWx.num; useframe.canvas.manager.numinstead.FigureFrameWx.toolbar; useframe.GetToolBar()instead.FigureFrameWx.toolmanager; useframe.canvas.manager.toolmanagerinstead.
Modules#
The modules matplotlib.afm, matplotlib.docstring,
matplotlib.fontconfig_pattern, matplotlib.tight_bbox,
matplotlib.tight_layout, and matplotlib.type1font are considered
internal and public access is deprecated.
checkdep_usetex deprecated#
This method was only intended to disable tests in case no latex install was found. As such, it is considered to be private and for internal use only.
Please vendor the code if you need this.
date_ticker_factory deprecated#
The date_ticker_factory method in the matplotlib.dates module is
deprecated. Instead use AutoDateLocator and AutoDateFormatter for a
more flexible and scalable locator and formatter.
If you need the exact date_ticker_factory behavior, please copy the code.
dviread.find_tex_file will raise FileNotFoundError#
In the future, dviread.find_tex_file will raise a FileNotFoundError for
missing files. Previously, it would return an empty string in such cases.
Raising an exception allows attaching a user-friendly message instead. During
the transition period, a warning is raised.
transforms.Affine2D.identity()#
... is deprecated in favor of directly calling the Affine2D constructor with
no arguments.
Deprecations in testing.decorators#
The unused class CleanupTestCase and decorator cleanup are deprecated
and will be removed. Vendor the code, including the private function
_cleanup_cm.
The function check_freetype_version is considered internal and deprecated.
Vendor the code of the private function _check_freetype_version.
text.get_rotation()#
... is deprecated with no replacement. Copy the original implementation if needed.
Miscellaneous internals#
axes_grid1.axes_size.AddList; usesum(sizes, start=Fixed(0))(for example) to sum multiple size objects.axes_size.Padded; usesize + padinsteadaxes_size.SizeFromFunc,axes_size.GetExtentHelperAxisArtistHelper.delta1andAxisArtistHelper.delta2axislines.GridHelperBase.new_gridlinesandaxislines.Axes.new_gridlinescbook.maxdict; use the standard libraryfunctools.lru_cacheinstead._DummyAxis.dataLimand_DummyAxis.viewLim; useget_data_interval(),set_data_interval(),get_view_interval(), andset_view_interval()instead.GridSpecBase.get_grid_positions(..., raw=True)ImageMagickBase.delayandImageMagickBase.output_argsMathtextBackend,MathtextBackendAgg,MathtextBackendPath,MathTextWarningTexManager.get_font_config; it previously returned an internal hashed key for used for caching purposes.TextToPath.get_texmanager; directly construct atexmanager.TexManagerinstead.ticker.is_close_to_int; usemath.isclose(x, round(x))instead.ticker.is_decade; usey = numpy.log(x)/numpy.log(base); numpy.isclose(y, numpy.round(y))instead.
Removals#
The following deprecated APIs have been removed:
Removed behaviour#
Stricter validation of function parameters#
Unknown keyword arguments to
Figure.savefig,pyplot.savefig, and theFigureCanvas.print_*methods now raise aTypeError, instead of being ignored.Extra parameters to the
Axesconstructor, i.e., those other than fig and rect, are now keyword only.Passing arguments not specifically listed in the signatures of
Axes3D.plot_surfaceandAxes3D.plot_wireframeis no longer supported; pass any extra arguments as keyword arguments instead.Passing positional arguments to
LineCollectionhas been removed; use specific keyword argument names now.
imread no longer accepts URLs#
Passing a URL to imread() has been removed. Please open the URL for
reading and directly use the Pillow API (e.g.,
PIL.Image.open(urllib.request.urlopen(url)), or
PIL.Image.open(io.BytesIO(requests.get(url).content))) instead.
MarkerStyle is immutable#
The methods MarkerStyle.set_fillstyle and MarkerStyle.set_marker have
been removed. Create a new MarkerStyle with the respective parameters
instead.
Passing bytes to FT2Font.set_text#
... is no longer supported. Pass str instead.
Support for passing tool names to ToolManager.add_tool#
... has been removed. The second parameter to ToolManager.add_tool must now
always be a tool class.
backend_tools.ToolFullScreen now inherits from ToolBase, not from ToolToggleBase#
ToolFullScreen can only switch between the non-fullscreen and fullscreen
states, but not unconditionally put the window in a given state; hence the
enable and disable methods were misleadingly named. Thus, the
ToolToggleBase-related API (enable, disable, etc.) was removed.
BoxStyle._Base and transmute method of box styles#
... have been removed. Box styles implemented as classes no longer need to inherit from a base class.
Loaded modules logging#
The list of currently loaded modules is no longer logged at the DEBUG level at
Matplotlib import time, because it can produce extensive output and make other
valuable DEBUG statements difficult to find. If you were relying on this
output, please arrange for your own logging (the built-in sys.modules can be
used to get the currently loaded modules).
Modules#
The
cbook.deprecationmodule has been removed from the public API as it is considered internal.The
mpl_toolkits.axes_gridmodule has been removed. All functionality frommpl_toolkits.axes_gridcan be found in eithermpl_toolkits.axes_grid1ormpl_toolkits.axisartist. Axes classes frommpl_toolkits.axes_gridbased onAxisfrommpl_toolkits.axisartistcan be found inmpl_toolkits.axisartist.
Classes, methods and attributes#
The following module-level classes/variables have been removed:
cm.cmap_dcolorbar.colorbar_doc,colorbar.colorbar_kw_docColorbarPatchmathtext.Fontsand all its subclassesmathtext.FontConstantsBaseand all its subclassesmathtext.latex_to_bakoma,mathtext.latex_to_cmex,mathtext.latex_to_standardmathtext.MathtextBackendPdf,mathtext.MathtextBackendPs,mathtext.MathtextBackendSvg,mathtext.MathtextBackendCairo; use.MathtextBackendPathinstead.mathtext.Nodeand all its subclassesmathtext.NUM_SIZE_LEVELSmathtext.Parsermathtext.Shipmathtext.SHRINK_FACTORandmathtext.GROW_FACTORmathtext.stix_virtual_fonts,mathtext.tex2unibackend_pgf.TmpDirCleanerbackend_ps.GraphicsContextPS; useGraphicsContextBaseinstead.backend_wx.IDLE_DELAYaxes_grid1.parasite_axes.ParasiteAxesAuxTransBase; useParasiteAxesBaseinstead.axes_grid1.parasite_axes.ParasiteAxesAuxTrans; useParasiteAxesinstead.
The following class attributes have been removed:
Line2D.validCapandLine2D.validJoin; validation is centralized inrcsetup.Patch.validCapandPatch.validJoin; validation is centralized inrcsetup.renderer.M,renderer.eye,renderer.vvec,renderer.get_axis_positionplaced on the Renderer during 3D Axes draw; these attributes are all available viaAxes3D, which can be accessed viaself.axeson allArtists.RendererPdf.mathtext_parser,RendererPS.mathtext_parser,RendererSVG.mathtext_parser,RendererCairo.mathtext_parserStandardPsFonts.pswriterSubplot.figbox; useAxes.get_positioninstead.Subplot.numRows;ax.get_gridspec().nrowsinstead.Subplot.numCols;ax.get_gridspec().ncolsinstead.SubplotDivider.figboxcids,cnt,observers,change_observers, andsubmit_observerson allWidgets
The following class methods have been removed:
Axis.cla(); useAxis.clearinstead.RadialAxis.cla()andThetaAxis.cla(); useRadialAxis.clearorThetaAxis.clearinstead.Spine.cla(); useSpine.clearinstead.ContourLabeler.get_label_coords(); there is no replacement as it was considered an internal helper.FancyArrowPatch.get_dpi_corandFancyArrowPatch.set_dpi_corFigureCanvas.get_window_title()andFigureCanvas.set_window_title(); useFigureManagerBase.get_window_titleorFigureManagerBase.set_window_titleif using pyplot, or use GUI-specific methods if embedding.FigureManager.key_press()andFigureManager.button_press(); trigger the events directly on the canvas usingcanvas.callbacks.process(event.name, event)for key and button events.RendererAgg.get_content_extents()andRendererAgg.tostring_rgba_minimized()NavigationToolbar2Wx.get_canvas()ParasiteAxesBase.update_viewlim(); useParasiteAxesBase.apply_aspectinstead.Subplot.get_geometry(); useSubplotBase.get_subplotspecinstead.Subplot.change_geometry(); useSubplotBase.set_subplotspecinstead.Subplot.update_params(); this method did nothing.Subplot.is_first_row(); useax.get_subplotspec().is_first_rowinstead.Subplot.is_first_col(); useax.get_subplotspec().is_first_colinstead.Subplot.is_last_row(); useax.get_subplotspec().is_last_rowinstead.Subplot.is_last_col(); useax.get_subplotspec().is_last_colinstead.SubplotDivider.change_geometry(); useSubplotDivider.set_subplotspecinstead.SubplotDivider.get_geometry(); useSubplotDivider.get_subplotspecinstead.SubplotDivider.update_params()get_depth,parse,to_mask,to_rgba, andto_pngofMathTextParser; usemathtext.math_to_imageinstead.MovieWriter.cleanup(); the cleanup logic is instead fully implemented inMovieWriter.finishandcleanupis no longer called.
Functions#
The following functions have been removed;
backend_template.new_figure_manager(),backend_template.new_figure_manager_given_figure(), andbackend_template.draw_if_interactive()have been removed, as part of the introduction of the simplified backend API.Deprecation-related re-imports
cbook.deprecated(), andcbook.warn_deprecated().colorbar.colorbar_factory(); useColorbarinstead.colorbar.make_axes_kw_doc()mathtext.Error()mathtext.ship()mathtext.tex2uni()axes_grid1.parasite_axes.parasite_axes_auxtrans_class_factory(); useparasite_axes_class_factoryinstead.sphinext.plot_directive.align(); usedocutils.parsers.rst.directives.images.Image.aligninstead.
Arguments#
The following arguments have been removed:
dpi from
print_ps()in the PS backend andprint_pdf()in the PDF backend. Instead, the methods will obtain the DPI from thesavefigmachinery.dpi_cor from
FancyArrowPatchminimum_descent from
TextArea; it is now effectively always Trueorigin from
FigureCanvasWx.gui_repaint()project from
Line3DCollection.draw()renderer from
Line3DCollection.do_3d_projection,Patch3D.do_3d_projection,PathPatch3D.do_3d_projection,Path3DCollection.do_3d_projection,Patch3DCollection.do_3d_projection,Poly3DCollection.do_3d_projectionresize_callback from the Tk backend; use
get_tk_widget().bind('<Configure>', ..., True)instead.return_all from
gridspec.get_position()Keyword arguments to
gca(); there is no replacement.
rcParams#
The setting rcParams["ps.useafm"] (default: False) no longer has any effect on matplotlib.mathtext.
Development changes#
Increase to minimum supported versions of dependencies#
For Matplotlib 3.6, the minimum supported versions are being bumped:
Dependency |
min in mpl3.5 |
min in mpl3.6 |
|---|---|---|
Python |
3.7 |
3.8 |
NumPy |
1.17 |
1.19 |
This is consistent with our Dependency version policy and NEP29
Build setup options changes#
The gui_support.macosx setup option has been renamed to
packages.macosx.
New wheel architectures#
Wheels have been added for:
Python 3.11
PyPy 3.8 and 3.9
Increase to required versions of documentation dependencies#
sphinx >= 3.0 and numpydoc >= 1.0 are now required for building the documentation.