1
2API Changes in 2.0.0
3====================
4
5Deprecation and removal
6-----------------------
7
8Color of Axes
9~~~~~~~~~~~~~
10The ``axisbg`` and ``axis_bgcolor`` properties on *Axes* have been
11deprecated in favor of ``facecolor``.
12
13GTK and GDK backends deprecated
14~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15The GDK and GTK backends have been deprecated. These obsolete backends
16allow figures to be rendered via the GDK API to files and GTK2 figures.
17They are untested and known to be broken, and their use has been
18discouraged for some time.  Instead, use the ``GTKAgg`` and ``GTKCairo``
19backends for rendering to GTK2 windows.
20
21WX backend deprecated
22~~~~~~~~~~~~~~~~~~~~~
23The WX backend has been deprecated.  It is untested, and its
24use has been discouraged for some time. Instead, use the ``WXAgg``
25backend for rendering figures to WX windows.
26
27CocoaAgg backend removed
28~~~~~~~~~~~~~~~~~~~~~~~~
29The deprecated and not fully functional CocoaAgg backend has been removed.
30
31`round` removed from TkAgg Backend
32~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33The TkAgg backend had its own implementation of the `round` function. This
34was unused internally and has been removed. Instead, use either the
35`round` builtin function or `numpy.around`.
36
37.. _v200_deprecate_hold:
38
39'hold' functionality deprecated
40~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41The 'hold' keyword argument and all functions and methods related
42to it are deprecated, along with the ``axes.hold`` rcParams entry.
43The behavior will remain consistent with the default ``hold=True``
44state that has long been in place.  Instead of using a function
45or keyword argument (``hold=False``) to change that behavior,
46explicitly clear the axes or figure as needed prior to subsequent
47plotting commands.
48
49
50`.Artist.update` has return value
51---------------------------------
52
53The methods `matplotlib.artist.Artist.set`, `matplotlib.artist.Artist.update`,
54and the function `matplotlib.artist.setp` now use a common codepath to look up
55how to update the given artist properties (either using the setter methods or
56an attribute/property).
57
58The behavior of `matplotlib.artist.Artist.update` is slightly changed to return
59a list of the values returned from the setter methods to avoid changing the API
60of `matplotlib.artist.Artist.set` and `matplotlib.artist.setp`.
61
62The keys passed into `matplotlib.artist.Artist.update` are now converted to
63lower case before being processed, to match the behavior of
64`matplotlib.artist.Artist.set` and `matplotlib.artist.setp`.  This should not
65break any user code because there are no set methods with capitals in
66their names, but this puts a constraint on naming properties in the future.
67
68
69`.Legend` initializers gain *edgecolor* and *facecolor* keyword arguments
70-------------------------------------------------------------------------
71
72The :class:`~matplotlib.legend.Legend` background patch (or 'frame')
73can have its ``edgecolor`` and ``facecolor`` determined by the
74corresponding keyword arguments to the :class:`matplotlib.legend.Legend`
75initializer, or to any of the methods or functions that call that
76initializer.  If left to their default values of `None`, their values
77will be taken from ``matplotlib.rcParams``.  The previously-existing
78``framealpha`` kwarg still controls the alpha transparency of the
79patch.
80
81
82Qualitative colormaps
83---------------------
84
85Colorbrewer's qualitative/discrete colormaps ("Accent", "Dark2", "Paired",
86"Pastel1", "Pastel2", "Set1", "Set2", "Set3") are now implemented as
87`.ListedColormap` instead of `.LinearSegmentedColormap`.
88
89To use these for images where categories are specified as integers, for
90instance, use::
91
92    plt.imshow(x, cmap='Dark2', norm=colors.NoNorm())
93
94
95Change in the ``draw_image`` backend API
96----------------------------------------
97
98The ``draw_image`` method implemented by backends has changed its interface.
99
100This change is only relevant if the backend declares that it is able
101to transform images by returning ``True`` from ``option_scale_image``.
102See the ``draw_image`` docstring for more information.
103
104
105
106``matplotlib.ticker.LinearLocator`` algorithm update
107----------------------------------------------------
108
109The `matplotlib.ticker.LinearLocator` is used to define the range and
110location of axis ticks when the user wants an exact number of ticks.
111``LinearLocator`` thus differs from the default locator ``MaxNLocator``,
112for which the user specifies a maximum number of intervals rather than
113a precise number of ticks.
114
115The view range algorithm in ``matplotlib.ticker.LinearLocator`` has been
116changed so that more convenient tick locations are chosen. The new algorithm
117returns a plot view range that is a multiple of the user-requested number of
118ticks. This ensures tick marks will be located at whole integers more
119consistently. For example, when both y-axes of a``twinx`` plot use
120``matplotlib.ticker.LinearLocator`` with the same number of ticks,
121their y-tick locations and grid lines will coincide.
122
123`matplotlib.ticker.LogLocator` gains numticks kwarg
124---------------------------------------------------
125
126The maximum number of ticks generated by the
127`~matplotlib.ticker.LogLocator` can now be controlled explicitly
128via setting the new 'numticks' kwarg to an integer.  By default
129the kwarg is None which internally sets it to the 'auto' string,
130triggering a new algorithm for adjusting the maximum according
131to the axis length relative to the ticklabel font size.
132
133`matplotlib.ticker.LogFormatter`: two new kwargs
134------------------------------------------------
135
136Previously, minor ticks on log-scaled axes were not labeled by
137default.  An algorithm has been added to the
138`~matplotlib.ticker.LogFormatter` to control the labeling of
139ticks between integer powers of the base.  The algorithm uses
140two parameters supplied in a kwarg tuple named 'minor_thresholds'.
141See the docstring for further explanation.
142
143To improve support for axes using `~matplotlib.ticker.SymmetricalLogLocator`,
144a *linthresh* keyword argument was added.
145
146
147New defaults for 3D quiver function in mpl_toolkits.mplot3d.axes3d.py
148---------------------------------------------------------------------
149
150Matplotlib has both a 2D and a 3D ``quiver`` function. These changes
151affect only the 3D function and make the default behavior of the 3D
152function match the 2D version. There are two changes:
153
1541) The 3D quiver function previously normalized the arrows to be the
155   same length, which makes it unusable for situations where the
156   arrows should be different lengths and does not match the behavior
157   of the 2D function. This normalization behavior is now controlled
158   with the ``normalize`` keyword, which defaults to False.
159
1602) The ``pivot`` keyword now defaults to ``tail`` instead of
161   ``tip``. This was done in order to match the default behavior of
162   the 2D quiver function.
163
164To obtain the previous behavior with the 3D quiver function, one can
165call the function with ::
166
167   ax.quiver(x, y, z, u, v, w, normalize=True, pivot='tip')
168
169where "ax" is an ``Axes3d`` object created with something like ::
170
171   import mpl_toolkits.mplot3d.axes3d
172   ax = plt.subplot(111, projection='3d')
173
174
175Stale figure behavior
176---------------------
177
178Attempting to draw the figure will now mark it as not stale (independent if
179the draw succeeds).  This change is to prevent repeatedly trying to re-draw a
180figure which is raising an error on draw.  The previous behavior would only mark
181a figure as not stale after a full re-draw succeeded.
182
183
184The spectral colormap is now nipy_spectral
185------------------------------------------
186
187The colormaps formerly known as ``spectral`` and ``spectral_r`` have been
188replaced by ``nipy_spectral`` and ``nipy_spectral_r`` since Matplotlib
1891.3.0. Even though the colormap was deprecated in Matplotlib 1.3.0, it never
190raised a warning. As of Matplotlib 2.0.0, using the old names raises a
191deprecation warning. In the future, using the old names will raise an error.
192
193Default install no longer includes test images
194----------------------------------------------
195
196To reduce the size of wheels and source installs, the tests and
197baseline images are no longer included by default.
198
199To restore installing the tests and images, use a :file:`setup.cfg` with ::
200
201   [packages]
202   tests = True
203   toolkits_tests = True
204
205in the source directory at build/install time.
206