| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
A log of changes to the most recent version of Matplotlib that affect the outward-facing API. If updating Matplotlib breaks your scripts, this list may help you figure out what caused the breakage and how to fix it by updating your code. For API changes in older versions see Old API Changes.
For new features that were added to Matplotlib, see What's new in Matplotlib 3.0.3.
This pages lists API changes for the most recent version of Matplotlib.
Note
The list below is a table of contents of individual files from the 'next_api_changes' folder. When a release is made
- The full text list below should be moved into its own file in 'prev_api_changes' for minor and major versions, add sections at the top for bug-fix releases.
- All the files in 'next_api_changes' should be moved to the bottom of this page
- This note, and the toctree below should be commented out
matplotlib.font_manager.win32InstalledFonts returns an empty list instead of None if no fonts are found.
Switching backends via matplotlib.use is now allowed by default, regardless of whether matplotlib.pyplot has been imported. If the user tries to switch from an already-started interactive backend to a different interactive backend, an ImportError will be raised.
tight_layout.auto_adjust_subplotpars can return None now if the new subplotparams will collapse axes to zero width or height. This prevents tight_layout from being executed. Similarly tight_layout.get_tight_layout_figure will return None.
Matplotlib 3 only supports python 3.5 and higher.
Failure to load backend modules (macosx on non-framework builds and gtk3 when running headless) now raises ImportError (instead of RuntimeError and TypeError, respectively).
Third-party backends that integrate with an interactive framework are now encouraged to define the required_interactive_framework global value to one of the following values: "qt5", "qt4", "gtk3", "wx", "tk", or "macosx". This information will be used to determine whether it is possible to switch from a backend to another (specifically, whether they use the same interactive framework).
Axes.hist2d now uses pcolormesh instead of pcolorfast, which will improve the handling of log-axes. Note that the returned image now is of type QuadMesh instead of AxesImage.
For Matplotlib 3.0, all artists are now included in the bounding box returned by matplotlib.axes.Axes.get_tightbbox.
matplotlib.axes.Axes.get_tightbbox adds a new kwarg bbox_extra_artists to manually specify the list of artists on the axes to include in the tight bounding box calculation.
Layout tools like Figure.tight_layout, constrained_layout, and fig.savefig('fname.png', bbox_inches="tight") use matplotlib.axes.Axes.get_tightbbox to determine the bounds of each axes on a figure and adjust spacing between axes.
In Matplotlib 2.2 get_tightbbox started to include legends made on the axes, but still excluded some other artists, like text that may overspill an axes. This has been expanded to include all artists.
This new default may be overridden in either of three ways:
Text.set_text when passed a string value of None would set the string to "None", so subsequent calls to Text.get_text would return the ambiguous "None" string.
This change sets text objects passed None to have empty strings, so that Text.get_text returns an empty string.
They previously returned an array. Returning a tuple is consistent with the behavior for 2D axes.
i.e., it behaves case-insensitively on Windows only.
These arguments were renamed in 2.0 to x / y following the change of the default alignment from edge to center.
matplotlib.axes.Axes.margins() and mpl_toolkits.mplot3d.Axes3D.margins() no longer accept arbitrary keywords. TypeError will therefore be raised if unknown kwargs are passed; previously they would be silently ignored.
If too many positional arguments are passed, TypeError will be raised instead of ValueError, for consistency with other call-signature violations.
Axes3D.margins now raises TypeError instead of emitting a deprecation warning if only two positional arguments are passed. To supply only x and y margins, use keyword arguments.
PEP 3102 describes keyword-only arguments, which allow Matplotlib to provide explicit call signatures - where we previously used *args, **kwargs and kwargs.pop, we can now expose named arguments. In some places, unknown kwargs were previously ignored but now raise TypeError because **kwargs has been removed.
The decorators and classes in matplotlib.testing.decorators no longer destroy the warnings filter on exit. Instead, they restore the warnings filter that existed before the test started using warnings.catch_warnings.
The FigureManagerPdf, FigureManagerPS, and FigureManagerSVG classes, which were previously empty subclasses of FigureManagerBase (i.e., not adding or overriding any attribute or method), are now direct aliases for FigureManagerBase.
When called with preview=False, image.thumbnail previously returned an figure whose canvas class was set according to the output file extension. It now returns a figure whose canvas class is the base FigureCanvasBase (and relies on FigureCanvasBase.print_figure) to handle the canvas switching properly).
As a side effect of this change, image.thumbnail now also supports .ps, .eps, and .svgz output.
FuncAnimation now draws artists returned by the user- function according to their zorder when using blitting, instead of using the order in which they are being passed. However, note that only zorder of passed artists will be respected, as they are drawn on top of any existing artists (see #11369).
Selection of contour levels is now the same for contour and contourf; previously, for contour, levels outside the data range were deleted. (Exception: if no contour levels are found within the data range, the levels attribute is replaced with a list holding only the minimum of the data range.)
When contour is called with levels specified as a target number rather than a list, and the 'extend' kwarg is used, the levels are now chosen such that some data typically will fall in the extended range.
When contour is called with a LogNorm or a LogLocator, it will now select colors using the geometric mean rather than the arithmetic mean of the contour levels.
A bug was fixed where the last row and column of data in streamplot were being dropped.
The default value of the tick locator for dates, dates.AutoDateLocator kwarg interval_multiples was set to False which leads to not-nice looking automatic ticks in many instances. The much nicer interval_multiples=True is the new default. See below to get the old behavior back:
Axes.get_position used to return the original position unless a draw had been triggered or Axes.apply_aspect had been called, even if the kwarg original was set to False. Now Axes.apply_aspect is called so ax.get_position() will return the new modified position. To get the old behavior use ax.get_position(original=True).
Colorbar ticks now adjust for the size of the colorbar if the colorbar is made from a mappable that is not a contour or doesn't have a BoundaryNorm, or boundaries are not specified. If boundaries, etc are specified, the colorbar maintains the original behavior.
When using hexbin and plotting with a logarithmic color scale, the colorbar ticks are now correctly log scaled. Previously the tick values were linear scaled log(number of counts).
Previous behavior with the pgf backend was for text specified as black to actually be the default color of whatever was rendering the pgf file (which was of course usually black). The new behavior is that black text is black, regardless of the default color. However, this means that there is no way to fall back on the default color of the renderer.
The rc modifier functions rcdefaults, rc_file_defaults and rc_file now ignore rcParams in the matplotlib.style.core.STYLE_BLACKLIST set. In particular, this prevents the backend and interactive rcParams from being incorrectly modified by these functions.
In particular, this implies that CallbackRegistry.callbacks[signal] is now a mapping of callback ids to WeakMethods (i.e., they need to be first called with no arguments to retrieve the method itself).
The rcParam now defaults to True and is deprecated (i.e., in future versions of Maplotlib, unicode input will always be supported).
Moreover, the underlying implementation now uses \usepackage[utf8]{inputenc} instead of \usepackage{ucs}\usepackage[utf8x]{inputenc}.
ArtistInspector.get_aliases previously returned the set of aliases as {fullname: {alias1: None, alias2: None, ...}}. The dict-to-None mapping was used to simulate a set in earlier versions of Python. It has now been replaced by a set, i.e. {fullname: {alias1, alias2, ...}}.
This value is also stored in ArtistInspector.aliasd, which has likewise changed.
Since dateutil and pytz both provide time zones, and matplotlib already depends on dateutil, matplotlib will now use dateutil time zones internally and drop the redundant dependency on pytz. While dateutil time zones are preferred (and currently recommended in the Python documentation), the explicit use of pytz zones is still supported.
The following modules are deprecated:
The following classes, methods, functions, and attributes are deprecated:
The following keyword arguments are deprecated:
The following call signatures are deprecated:
The following rcParams are deprecated:
The LocatableAxes classes in toolkits have been deprecated. The base Axes classes provide the same functionality to all subclasses, thus these mixins are no longer necessary. Related functions have also been deprecated. Specifically:
Setting or unsetting hold (deprecated in version 2.0) has now been completely removed. Matplotlib now always behaves as if hold=True. To clear an axes you can manually use cla(), or to clear an entire figure use clf().
The following deprecated API elements have been removed:
The following API elements have been removed:
The matplotlib documentation used the proprietary sphinx directives htmlonly::, and latexonly::. These have been replaced with the standard sphinx directives only:: html and only:: latex. This change will not affect any users. Only downstream package maintainers, who have used the proprietary directives in their docs, will have to switch to the sphinx directives.
The symlink from lib/mpl_examples to ../examples has been removed. This is not installed as an importable package and should not affect end users, however this may require down-stream packagers to adjust. The content is still available top-level examples directory.
| Back | FazBrowse Home | New Git URL |