Skip to content

Commit 6008518

Browse files
committed
Add some more 3.5 what's new entries
1 parent 972254f commit 6008518

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

doc/users/prev_whats_new/whats_new_3.5.0.rst

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@ the :ref:`github-stats`.
1414
Figure and Axes creation / management
1515
=====================================
1616

17+
``subplot_mosaic`` supports simple Axes sharing
18+
-----------------------------------------------
19+
20+
`.Figure.subplot_mosaic`, `.pyplot.subplot_mosaic` support *simple* Axes
21+
sharing (i.e., only `True`/`False` may be passed to *sharex*/*sharey*). When
22+
`True`, tick label visibility and Axis units will be shared.
23+
24+
.. plot::
25+
:include-source:
26+
27+
layout = [
28+
['A', [['B', 'C'],
29+
['D', 'E']]],
30+
['F', 'G'],
31+
]
32+
fig = plt.figure(constrained_layout=True)
33+
ax_dict = fig.subplot_mosaic(layout, sharex=True, sharey=True)
34+
# All Axes use these scales after this call.
35+
ax_dict['A'].set(xscale='log', yscale='logit')
36+
1737
Figure now has ``draw_without_rendering`` method
1838
------------------------------------------------
1939

@@ -161,6 +181,12 @@ being "rgba" for the newly-available behavior.
161181
For more details see the discussion of the new keyword argument in
162182
:doc:`/gallery/images_contours_and_fields/image_antialiasing`.
163183

184+
``imshow`` supports half-float arrays
185+
-------------------------------------
186+
187+
The `~.axes.Axes.imshow` method now supports half-float arrays, i.e., NumPy
188+
arrays with dtype of ``np.float16``.
189+
164190
A callback registry has been added to Normalize objects
165191
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166192

@@ -202,6 +228,19 @@ parameter.
202228
Fonts and Text
203229
==============
204230

231+
Triple and quadruple dot mathtext accents
232+
-----------------------------------------
233+
234+
In addition to single and double dot accents, mathtext now supports triple and
235+
quadruple dot accents.
236+
237+
.. plot::
238+
:include-source:
239+
240+
fig = plt.figure(figsize=(3, 1))
241+
fig.text(0.5, 0.5, r'$\dot{a} \ddot{b} \dddot{c} \ddddot{d}$', fontsize=40,
242+
horizontalalignment='center', verticalalignment='center')
243+
205244
Font properties of legend title are configurable
206245
------------------------------------------------
207246

@@ -215,6 +254,14 @@ argument, for example:
215254
ax.legend(title='Points',
216255
title_fontproperties={'family': 'serif', 'size': 20})
217256

257+
``Text`` and ``TextBox`` added *parse_math* option
258+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259+
260+
`.Text` and `.TextBox` objects now allow a *parse_math* keyword-only argument
261+
which controls whether math should be parsed from the displayed string. If
262+
*True*, the string will be parsed as a math text object. If *False*, the string
263+
will be considered a literal and no parsing will occur.
264+
218265
Text can be positioned inside TextBox widget
219266
--------------------------------------------
220267

@@ -358,9 +405,61 @@ Allow changing the vertical axis in 3d plots
358405
ax.set(xlabel='x', ylabel='y', zlabel='z',
359406
title=f'vertical_axis={vert_a!r}')
360407

408+
``plot_surface`` supports masked arrays and NaNs
409+
------------------------------------------------
410+
411+
`.axes3d.Axes3D.plot_surface` supports masked arrays and NaNs, and will now
412+
hide quads that contain masked or NaN points. The behaviour is similar to
413+
`.Axes.contour` with ``corner_mask=True``.
414+
415+
.. plot::
416+
417+
import matplotlib
418+
import matplotlib.pyplot as plt
419+
import numpy as np
420+
421+
fig, ax = plt.subplots(figsize=(6, 6), subplot_kw={'projection': '3d'},
422+
constrained_layout=True)
423+
424+
x, y = np.mgrid[1:10:1, 1:10:1]
425+
z = x ** 3 + y ** 3 - 500
426+
z = np.ma.masked_array(z, z < 0)
427+
428+
ax.plot_surface(x, y, z, rstride=1, cstride=1, linewidth=0, cmap='inferno')
429+
ax.view_init(35, -90)
430+
431+
3D plotting methods support *data* keyword argument
432+
---------------------------------------------------
433+
434+
To match all 2D plotting methods, the 3D Axes now support the *data* keyword
435+
argument. This allows passing arguments indirectly from a DataFrame-like
436+
structure. ::
437+
438+
data = { # A labelled data set, or e.g., Pandas DataFrame.
439+
'x': ...,
440+
'y': ...,
441+
'z': ...,
442+
'width': ...,
443+
'depth': ...,
444+
'top': ...,
445+
}
446+
447+
fig, ax = plt.subplots(subplot_kw={'projection': '3d')
448+
ax.bar3d('x', 'y', 'z', 'width', 'depth', 'top', data=data)
449+
361450
Interactive tool improvements
362451
=============================
363452

453+
Colorbars now have pan and zoom functionality
454+
---------------------------------------------
455+
456+
Interactive plots with colorbars can now be zoomed and panned on the colorbar
457+
axis. This adjusts the *vmin* and *vmax* of the ``ScalarMappable`` associated
458+
with the colorbar. This is currently only enabled for continuous norms. Norms
459+
used with contourf and categoricals, such as ``BoundaryNorm`` and ``NoNorm``,
460+
have the interactive capability disabled by default. ``cb.ax.set_navigate()``
461+
can be used to set whether a colorbar axes is interactive or not.
462+
364463
Updated the appearance of Slider widgets
365464
----------------------------------------
366465

@@ -474,6 +573,14 @@ from being processed and let all other signals pass.
474573
with fig.canvas.callbacks.blocked(signal="key_press_event"):
475574
plt.show()
476575
576+
Directional sizing cursors
577+
--------------------------
578+
579+
Canvases now support setting directional sizing cursors, i.e., horizontal and
580+
vertical double arrows. These are used in e.g., selector widgets. Try the
581+
:doc:`/gallery/widgets/mouse_cursor` example to see the cursor in your desired
582+
backend.
583+
477584
Sphinx extensions
478585
=================
479586

0 commit comments

Comments
 (0)