API Changes in 1.2.x#
classicoption of the rc parameter
toolbaris deprecated and will be removed in the next release.
matplotlib.cbook.isvectormethod has been removed since it is no longer functional.
Axessets a zorder below which artists are rasterized. This has defaulted to -30000.0, but it now defaults to None, meaning no artists will be rasterized. In order to rasterize artists below a given zorder value,
set_rasterization_zordermust be explicitly called.
contourf(), the handling of the extend kwarg has changed. Formerly, the extended ranges were mapped after to 0, 1 after being normed, so that they always corresponded to the extreme values of the colormap. Now they are mapped outside this range so that they correspond to the special colormap values determined by the
set_over()methods, which default to the colormap end points.
The new rc parameter
savefig.extension, and sets the default file format used by
matplotlib.projections.projection_factoryis now deprecated in favour of axes class identification using
matplotlib.projections.process_projection_requirementsfollowed by direct axes class invocation (at the time of writing, functions which do this are:
key = figure._make_key(*args, **kwargs) ispolar = kwargs.pop('polar', False) projection = kwargs.pop('projection', None) if ispolar: if projection is not None and projection != 'polar': raise ValueError('polar and projection args are inconsistent') projection = 'polar' ax = projection_factory(projection, self, rect, **kwargs) key = self._make_key(*args, **kwargs) # is now projection_class, kwargs, key = \ process_projection_requirements(self, *args, **kwargs) ax = projection_class(self, rect, **kwargs)
This change means that third party objects can expose themselves as Matplotlib axes by providing a
matplotlib.projectionsfor more detail.
A new keyword capthick in
errorbar()has been added as an intuitive alias to the markeredgewidth and mew keyword arguments, which indirectly controlled the thickness of the caps on the errorbars. For backwards compatibility, specifying either of the original keyword arguments will override any value provided by capthick.
Transform subclassing behaviour is now subtly changed. If your transform implements a non-affine transformation, then it should override the
transform_non_affinemethod, rather than the generic
transformmethod. Previously transforms would define
transformand then copy the method into
class MyTransform(mtrans.Transform): def transform(self, xy): ... transform_non_affine = transform
This approach will no longer function correctly and should be changed to:
class MyTransform(mtrans.Transform): def transform_non_affine(self, xy): ...
Artists no longer have
y_isdataattributes; instead any artist's transform can be interrogated with
Lines added to an axes now take into account their transform when updating the data and view limits. This means transforms can now be used as a pre-transform. For instance:
>>> import matplotlib.pyplot as plt >>> import matplotlib.transforms as mtrans >>> ax = plt.axes() >>> ax.plot(range(10), transform=mtrans.Affine2D().scale(10) + ax.transData) >>> print(ax.viewLim) Bbox('array([[ 0., 0.],\n [ 90., 90.]])')
One can now easily get a transform which goes from one transform's coordinate system to another, in an optimized way, using the new subtract method on a transform. For instance, to go from data coordinates to axes coordinates:
>>> import matplotlib.pyplot as plt >>> ax = plt.axes() >>> data2ax = ax.transData - ax.transAxes >>> print(ax.transData.depth, ax.transAxes.depth) 3, 1 >>> print(data2ax.depth) 2
for versions before 1.2 this could only be achieved in a sub-optimal way, using
ax.transData + ax.transAxes.inverted()(depth is a new concept, but had it existed it would return 4 for this example).
twinynow returns an instance of SubplotBase if parent axes is an instance of SubplotBase.
All Qt3-based backends are now deprecated due to the lack of py3k bindings. Qt and QtAgg backends will continue to work in v1.2.x for py2.6 and py2.7. It is anticipated that the Qt3 support will be completely removed for the next release.
ContourSet instances no longer have a
transformattribute. Instead, access the transform with the