Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 18c6da2

Browse files
committed
DOC: work on what_new for 3.1
- adjust adornments - minor rewords / copy editing - make more things cross-refernecs - adopt Jody's wording on OSX non-framework
1 parent 372ddd9 commit 18c6da2

File tree

1 file changed

+149
-95
lines changed

1 file changed

+149
-95
lines changed

doc/users/whats_new.rst

Lines changed: 149 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.. _whats=new:
1+
.. _whats-new:
22

3-
=============================
3+
==============================
44
What's new in Matplotlib 3.1
5-
=============================
5+
==============================
66

77
For a list of all of the issues and pull requests since the last
88
revision, see the :ref:`github-stats`.
@@ -14,10 +14,11 @@ revision, see the :ref:`github-stats`.
1414
:maxdepth: 4
1515

1616
New Features
17-
=============
17+
============
1818

1919
`~.dates.ConciseDateFormatter`
20-
-------------------------------
20+
------------------------------
21+
2122
The automatic date formatter used by default can be quite verbose. A new
2223
formatter can be accessed that tries to make the tick labels appropriately
2324
concise.
@@ -55,7 +56,8 @@ concise.
5556
plt.show()
5657

5758
Secondary x/y Axis support
58-
------------------------------------------------------------
59+
--------------------------
60+
5961
A new method provides the ability to add a second axis to an existing
6062
axes via `.Axes.secondary_xaxis` and `.Axes.secondary_yaxis`. See
6163
:doc:`/gallery/subplots_axes_and_figures/secondary_axis` for examples.
@@ -70,45 +72,53 @@ axes via `.Axes.secondary_xaxis` and `.Axes.secondary_yaxis`. See
7072

7173

7274
`~.scale.FuncScale` for arbitrary axes scales
73-
----------------------------------------------
75+
---------------------------------------------
76+
7477
A new `-.scale.FuncScale` class was added (and `-.scale.FuncTransform`)
7578
to allow the user to have arbitrary scale transformations without having to
76-
write a new subclass of `-.scale.ScaleBase`. This can be accessed by
77-
``ax.set_yscale('function', functions=(forward, inverse))``, where
78-
``forward`` and ``inverse`` are callables that return the scale transform and
79-
its inverse. See the last example in :doc:`/gallery/scales/scales`.
79+
write a new subclass of `-.scale.ScaleBase`. This can be accessed by::
80+
81+
ax.set_yscale('function', functions=(forward, inverse))
82+
83+
where ``forward`` and ``inverse`` are callables that return the scale
84+
transform and its inverse. See the last example in
85+
:doc:`/gallery/scales/scales`.
8086

8187

8288
Legend for scatter
83-
-------------------
84-
A new method for creating legends for scatter plots has been introduced.
85-
Previously, in order to obtain a legend for a :meth:`-.axes.Axes.scatter`
86-
plot, one could either plot several scatters, each with an individual label,
87-
or create proxy artists to show in the legend manually.
88-
Now, :class:`-.collections.PathCollection` provides a method
89-
:meth:`-.collections.PathCollection.legend_elements` to obtain the handles and labels
90-
for a scatter plot in an automated way. This makes creating a legend for a
91-
scatter plot as easy as::
89+
------------------
90+
91+
A new method for creating legends for scatter plots has been
92+
introduced. Previously, in order to obtain a legend for a
93+
:meth:`-.axes.Axes.scatter` plot, one could either plot several
94+
scatters, each with an individual label, or create proxy artists to
95+
show in the legend manually. Now,
96+
:class:`-.collections.PathCollection` provides a method
97+
:meth:`-.collections.PathCollection.legend_elements` to obtain the
98+
handles and labels for a scatter plot in an automated way. This makes
99+
creating a legend for a scatter plot as easy as
100+
101+
.. plot ::
92102
93103
scatter = plt.scatter([1,2,3], [4,5,6], c=[7,2,3])
94104
plt.legend(*scatter.legend_elements())
95105
96-
An example can be found in
97-
:ref:`automatedlegendcreation`.
106+
An example can be found in :ref:`automatedlegendcreation`.
98107

99108

100109
Figure, FigureCanvas, and Backends
101-
====================================
110+
==================================
102111

103112
Figure.frameon is now a direct proxy for the Figure patch visibility state
104-
---------------------------------------------------------------------------
113+
--------------------------------------------------------------------------
105114
Accessing ``Figure.frameon`` (including via ``get_frameon`` and ``set_frameon``
106115
now directly forwards to the visibility of the underlying Rectangle artist
107116
(``Figure.patch.get_frameon``, ``Figure.patch.set_frameon``).
108117

109118

110119
*pil_kwargs* argument added to savefig
111-
------------------------------------------------------------
120+
--------------------------------------
121+
112122
Matplotlib uses Pillow to handle saving to the JPEG and TIFF formats. The
113123
`-Figure.savefig()` function gained a *pil_kwargs* keyword argument, which can
114124
be used to forward arguments to Pillow's `PIL.Image.save()`.
@@ -118,38 +128,44 @@ Matplotlib also uses Pillow's `PIL.Image.save()` instead of going through its
118128
own builtin PNG support.
119129

120130

121-
Add ``inaxes`` method to `FigureCanvas`
122-
----------------------------------------
123-
The `FigureCanvas` class has now an ``inaxes`` method to check whether a point is in an axes
124-
and returns the topmost axes, else None.
131+
Add ``inaxes`` method to `.FigureCanvasBase`
132+
--------------------------------------------
133+
134+
The `.FigureCanvasBase` class has now an `~.FigureCanvasBase.inaxes`
135+
method to check whether a point is in an axes and returns the topmost
136+
axes, else None.
125137

126138
cairo backend defaults to pycairo instead of cairocffi
127-
------------------------------------------------------------
139+
------------------------------------------------------
140+
128141
This leads to faster import/runtime performance in some cases. The backend
129142
will fall back to cairocffi in case pycairo isn't available.
130143

131144

132145
Axes and Artists
133-
===================
146+
================
147+
134148
axes_grid1 and axisartist Axes no longer draw spines twice
135-
------------------------------------------------------------
149+
----------------------------------------------------------
150+
136151
Previously, spines of `axes_grid1` and `axisartist` Axes would be drawn twice,
137152
leading to a "bold" appearance. This is no longer the case.
138153

139154

140155
Return type of ArtistInspector.get_aliases changed
141156
--------------------------------------------------
142-
`ArtistInspector.get_aliases` previously returned the set of aliases as
157+
`.ArtistInspector.get_aliases` previously returned the set of aliases as
143158
``{fullname: {alias1: None, alias2: None, ...}}``. The dict-to-None mapping
144159
was used to simulate a set in earlier versions of Python. It has now been
145160
replaced by a set, i.e. ``{fullname: {alias1, alias2, ...}}``.
146161

147-
This value is also stored in `ArtistInspector.aliasd`, which has likewise
162+
This value is also stored in `.ArtistInspector.aliasd`, which has likewise
148163
changed.
149164

150165

151-
`ConnectionPatch` accepts arbitrary transforms
166+
`.ConnectionPatch` accepts arbitrary transforms
152167
-----------------------------------------------
168+
153169
Alternatively to strings like ``"data"`` or ``"axes fraction"``
154170
`ConnectionPatch` now accepts any `-matplotlib.transforms.Transform`
155171
as input for the ``coordsA`` and ``coordsB`` argument. This allows to
@@ -159,21 +175,24 @@ systems. Also see the :doc:`Connect Simple01 example
159175

160176

161177
mplot3d Line3D now allows {set,get}_data_3d
162-
--------------------------------------------
163-
Lines created with the 3d projection in mplot3d can now access the data using
164-
``mplot3d.art3d.Line3D.get_data_3d()`` which returns a tuple of array_likes containing
165-
the (x, y, z) data. The equivalent ``mplot3d.art3d.Line3D.set_data_3d(x, y, z)``
166-
can be used to modify the data of an existing Line3D.
178+
-------------------------------------------
179+
180+
Lines created with the 3d projection in mplot3d can now access the
181+
data using `~.mplot3d.art3d.Line3D.get_data_3d()` which returns a
182+
tuple of array_likes containing the (x, y, z) data. The equivalent
183+
`~.mplot3d.art3d.Line3D.set_data_3d` can be used to modify the data of
184+
an existing Line3D.
167185

168186

169187
``Axes3D.voxels`` now shades the resulting voxels
170-
------------------------------------------------------------
171-
The :meth:`-mpl_toolkits.mplot3d.Axes3D.voxels` method now takes a ``shade``
172-
parameter that defaults to ``True``. This shades faces based on their
173-
orientation, behaving just like the matching parameters to
188+
-------------------------------------------------
189+
190+
The :meth:`-mpl_toolkits.mplot3d.Axes3D.voxels` method now takes a
191+
*shade* parameter that defaults to `True`. This shades faces based
192+
on their orientation, behaving just like the matching parameters to
174193
:meth:`-mpl_toolkits.mplot3d.Axes3D.trisurf` and
175-
:meth:`-mpl_toolkits.mplot3d.Axes3D.bar3d`.
176-
The plot below shows how this affects the output.
194+
:meth:`-mpl_toolkits.mplot3d.Axes3D.bar3d`. The plot below shows how
195+
this affects the output.
177196

178197
.. plot::
179198

@@ -208,81 +227,105 @@ The plot below shows how this affects the output.
208227
plt.show()
209228

210229
Axis and Ticks
211-
===============
230+
==============
212231

213-
Added `Axis.get_inverted` and `Axis.set_inverted`
214-
-------------------------------------------------
215-
The `Axis.get_inverted` and `Axis.set_inverted` methods query and set whether
232+
Added `.Axis.get_inverted` and `.Axis.set_inverted`
233+
---------------------------------------------------
234+
The `.Axis.get_inverted` and `.Axis.set_inverted` methods query and set whether
216235
the axis uses "inverted" orientation (i.e. increasing to the left for the
217236
x-axis and to the bottom for the y-axis).
218237

219-
They perform tasks similar to `Axes.xaxis_inverted`, `Axes.yaxis_inverted`,
220-
`Axes.invert_xaxis`, and `Axes.invert_yaxis`, with the specific difference that
221-
`.set_inverted` makes it easier to set the invertedness of an axis regardless
222-
of whether it had previously been inverted before.
238+
They perform tasks similar to `.Axes.xaxis_inverted`,
239+
`.Axes.yaxis_inverted`, `.Axes.invert_xaxis`, and
240+
`.Axes.invert_yaxis`, with the specific difference that
241+
`.Axes..set_inverted` makes it easier to set the invertedness of an
242+
axis regardless of whether it had previously been inverted before.
223243

224244
Adjust default minor tick spacing
225-
----------------------------------
245+
---------------------------------
246+
226247
Default minor tick spacing was changed from 0.625 to 0.5 for major ticks spaced
227248
2.5 units apart.
228249

229250

230-
`EngFormatter` now accepts `usetex`, `useMathText` as keyword only arguments
231-
----------------------------------------------------------------------------
232-
A public API has been added to `EngFormatter` to control how the numbers in the
233-
ticklabels will be rendered. By default, ``useMathText`` evaluates to
234-
``rcParams['axes.formatter.use_mathtext']`` and ``usetex`` evaluates to
235-
``rcParams['text.usetex']``.
251+
`.EngFormatter` now accepts `usetex`, `useMathText` as keyword only arguments
252+
-----------------------------------------------------------------------------
236253

237-
If either is ``True`` then the numbers will be encapsulated by ``$`` signs.
238-
When using ``TeX`` this implies that the numbers will be shown in TeX's math
239-
font. When using mathtext, the ``$`` signs around numbers will ensure unicode
240-
rendering (as implied by mathtext). This will make sure that the minus signs
241-
in the ticks are rendered as the unicode=minus (U+2212) when using mathtext
242-
(without relying on the ``fix_minus`` method).
254+
A public API has been added to `EngFormatter` to control how the
255+
numbers in the ticklabels will be rendered. By default,
256+
``useMathText`` evaluates to
257+
:rc:`rcParams['axes.formatter.use_mathtext']` and ``usetex`` evaluates
258+
to :rc:`rcParams['text.usetex']`.
259+
260+
If either is `True` then the numbers will be encapsulated by ``$``
261+
signs. When using ``TeX`` this implies that the numbers will be shown
262+
in TeX's math font. When using mathtext, the ``$`` signs around
263+
numbers will ensure unicode rendering (as implied by mathtext). This
264+
will make sure that the minus signs in the ticks are rendered as the
265+
unicode=minus (U+2212) when using mathtext (without relying on the
266+
`~.Fomatter.fix_minus` method).
243267

244268

245269

246270
Animation and Interactivity
247-
============================
271+
===========================
272+
248273
Support for forward/backward mouse buttons
249274
-------------------------------------------
250-
Figure managers now support a ``button_press`` event for mouse buttons, similar
251-
to the ``key_press`` events. This allows binding actions to mouse buttons (see
252-
`.MouseButton`) The first application of this mechanism is support of forward/backward mouse
253-
buttons in figures created with the Qt5 backend.
254275

276+
Figure managers now support a ``button_press`` event for mouse
277+
buttons, similar to the ``key_press`` events. This allows binding
278+
actions to mouse buttons (see `.MouseButton`) The first application of
279+
this mechanism is support of forward/backward mouse buttons in figures
280+
created with the Qt5 backend.
255281

256-
*progress_callback* argument to ani.save()
257-
-------------------------------------------
258-
The method .FuncAnimation.save() gained an optional *progress_callback* argument to notify the saving progress.
259282

260-
Add ``cache_frame_data`` keyword-only argument into ``matplotlib.animation.FuncAnimation``
261-
-------------------------------------------------------------------------------------------
262-
| ``matplotlib.animation.FuncAnimation`` has been caching frame data by default; however, this caching is not ideal in certain cases e.g. When ``FuncAnimation`` needs to be only drawn(not saved) interactively and memory required by frame data is quite large. By adding ``cache_frame_data`` keyword-only argument, users can now disable this caching; thereby, this new argument provides a fix for issue #8528.
283+
*progress_callback* argument to `~.Animation.save()`
284+
----------------------------------------------------
285+
286+
The method .FuncAnimation.save() gained an optional
287+
*progress_callback* argument to notify the saving progress.
288+
289+
290+
Add ``cache_frame_data`` keyword-only argument into `.animation.FuncAnimation`
291+
------------------------------------------------------------------------------
292+
293+
`.matplotlib.animation.FuncAnimation` has been caching frame data by
294+
default; however, this caching is not ideal in certain cases e.g. When
295+
`.FuncAnimation` needs to be only drawn(not saved) interactively and
296+
memory required by frame data is quite large. By adding
297+
*cache_frame_data* keyword-only argument, users can now disable this
298+
caching; thereby, this new argument provides a fix for issue
299+
:ghissue:`8528`.
263300

264301

265302
Endless Looping GIFs with PillowWriter
266303
--------------------------------------
267-
We acknowledge that most people want to watch a gif more than once. Saving an animation as a gif with PillowWriter now produces an endless looping gif.
268304

305+
We acknowledge that most people want to watch a gif more than
306+
once. Saving an animation as a gif with PillowWriter now produces an
307+
endless looping gif.
269308

270-
Adjusted ``matplotlib.widgets.Slider`` to have vertical orientation
271-
--------------------------------------------------------------------
272-
The :class:`matplotlib.widgets.Slider` widget now takes an optional argument
273-
``orientation`` which indicates the direction (``'horizontal'`` or
274-
``'vertical'``) that the slider should take.
309+
310+
Adjusted `.matplotlib.widgets.Slider` to have vertical orientation
311+
------------------------------------------------------------------
312+
313+
The :class:`matplotlib.widgets.Slider` widget now takes an optional
314+
argument *orientation* which indicates the direction
315+
(``'horizontal'`` or ``'vertical'``) that the slider should take.
275316

276317
Improved formatting of image values under cursor when a colorbar is present
277318
---------------------------------------------------------------------------
319+
278320
When a colorbar is present, its formatter is now used to format the image
279321
values under the mouse cursor in the status bar. For example, for an image
280322
displaying the values 10,000 and 10,001, the statusbar will now (using default
281323
settings) display the values as ``10000`` and ``10001``), whereas both values
282324
were previously displayed as ``1e+04``.
283325

284326
MouseEvent button attribute is now an IntEnum
285-
----------------------------------------------
327+
---------------------------------------------
328+
286329
The :attr:`button` attribute of `-.MouseEvent` instances can take the values
287330
None, 1 (left button), 2 (middle button), 3 (right button), "up" (scroll), and
288331
"down" (scroll). For better legibility, the 1, 2, and 3 values are now
@@ -306,24 +349,35 @@ to load the matplotlibrc file from ``$MATPLOTLIBRC/matplotlibrc``.
306349

307350
Allow LaTeX code ``pgf.preamble`` and ``text.latex.preamble`` in MATPLOTLIBRC file
308351
----------------------------------------------------------------------------------
309-
Previously, the rc file keys ``pgf.preamble`` and ``text.latex.preamble`` were parsed using commmas as separators. This would break valid LaTeX code, such as::
310352

311-
\usepackage[protrusion=true, expansion=false]{microtype}
353+
Previously, the rc file keys :rc:`pgf.preamble` and
354+
:rc:`text.latex.preamble` were parsed using commas as separators. This
355+
would break valid LaTeX code, such as::
356+
357+
\usepackage[protrusion=true, expansion=false]{microtype}
312358

313-
The parsing has been modified to pass the complete line to the LaTeX system,
314-
keeping all commas. Passing a list of strings from within a Python script still works as it used to.
359+
The parsing has been modified to pass the complete line to the LaTeX
360+
system, keeping all commas. Passing a list of strings from within a
361+
Python script still works as it used to.
315362

316363

317-
Added support for MacOSX backend for PyPy
318-
------------------------------------------
319-
Fixed issue with MacOSX backend for PyPy and also for non-framework Python
320-
installations.
364+
Matplotlib no longer requires framework app build on MacOSX backend
365+
-------------------------------------------------------------------
366+
367+
Previous versions of matplotlin required a Framework build of python to
368+
work. The app type was updated to no longer require this, so the MacOSX
369+
backend should work with non-framework python.
370+
371+
372+
This also adds support support for the MacOSX backend for PyPy3.
373+
321374

322375

323376
New logging API
324377
----------------
325-
`matplotlib.set_loglevel`/`.pyplot.set_loglevel` can be called to display more
326-
(or less) detailed logging output.
378+
379+
`matplotlib.set_loglevel` / `.pyplot.set_loglevel` can be called to
380+
display more (or less) detailed logging output.
327381

328382

329383
===================

0 commit comments

Comments
 (0)