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

Skip to content

Commit 8eb3a06

Browse files
committed
Add some more 3.5 what's new entries
1 parent 54a791c commit 8eb3a06

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+
mosaic = [
28+
['A', [['B', 'C'],
29+
['D', 'E']]],
30+
['F', 'G'],
31+
]
32+
fig = plt.figure(constrained_layout=True)
33+
ax_dict = fig.subplot_mosaic(mosaic, 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 ``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

@@ -364,9 +411,61 @@ Allow changing the vertical axis in 3d plots
364411
ax.set(xlabel='x', ylabel='y', zlabel='z',
365412
title=f'vertical_axis={vert_a!r}')
366413

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

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

@@ -480,6 +579,14 @@ from being processed and let all other signals pass.
480579
with fig.canvas.callbacks.blocked(signal="key_press_event"):
481580
plt.show()
482581
582+
Directional sizing cursors
583+
--------------------------
584+
585+
Canvases now support setting directional sizing cursors, i.e., horizontal and
586+
vertical double arrows. These are used in e.g., selector widgets. Try the
587+
:doc:`/gallery/widgets/mouse_cursor` example to see the cursor in your desired
588+
backend.
589+
483590
Sphinx extensions
484591
=================
485592

0 commit comments

Comments
 (0)