Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteaaf4a8

Browse files
committed
DOC: Edit the 3.3 what's new based on review.
1 parenta43d8b3 commiteaaf4a8

File tree

1 file changed

+58
-24
lines changed

1 file changed

+58
-24
lines changed

‎doc/users/prev_whats_new/whats_new_3.3.0.rst

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,15 @@ as an alternative to ::
6262
fig.subplots(2, 2, gridspec_kw={"height_ratios": [3, 1]})
6363

6464

65-
NewTurbo colormap
66-
------------------
65+
Turbo colormap
66+
--------------
6767

6868
Turbo is an improved rainbow colormap for visualization, created by the Google
6969
AI team for computer visualization and machine learning. Its purpose is to
7070
display depth and disparity data. Please see the `Google AI Blog
7171
<https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html>`_
7272
for further details.
7373

74-
Below shows Turbo and some other rainbow-esque colormaps:
75-
7674
..plot::
7775

7876
gradient = np.linspace(0, 1, 256)
@@ -103,8 +101,8 @@ that pass through two points.
103101
ax.legend()
104102

105103

106-
New "extend" keywordto colors.BoundaryNorm
107-
-------------------------------------------
104+
``colors.BoundaryNorm`` supports *extend* keywordargument
105+
----------------------------------------------------------
108106

109107
`~.colors.BoundaryNorm` now has an *extend* keyword argument, analogous to
110108
*extend* in `~.axes.Axes.contourf`. When set to 'both', 'min', or 'max', it
@@ -281,8 +279,8 @@ set with the new rcParameter :rc:`axes.titley`.
281279
plt.show()
282280

283281

284-
Datesnowuse a modern epoch
285-
----------------------------
282+
Dates use a modern epoch
283+
------------------------
286284

287285
Matplotlib converts dates to days since an epoch using `.dates.date2num` (via
288286
`matplotlib.units`). Previously, an epoch of ``0000-12-31T00:00:00`` was used
@@ -299,17 +297,17 @@ by `~.dates.get_epoch`, and there is a new :rc:`date.epoch` rcParam. The user
299297
may also call `~.dates.set_epoch`, but it must be set *before* any date
300298
conversion or plotting is used.
301299

302-
If you have data stored as ordinal floats in the old epoch,a simple
303-
conversion (using the newepoch) is::
300+
If you have data stored as ordinal floats in the old epoch,you can convert
301+
them to the newordinal using the following formula::
304302

305303
new_ordinal = old_ordinal + mdates.date2num(np.datetime64('0000-12-31'))
306304

307305

308306
tight_layout now supports suptitle
309307
----------------------------------
310308

311-
Previous versions did not consider `.Figure.suptitle`,andso it may overlap
312-
withother artists after calling `~.Figure.tight_layout`:
309+
Previous versions did not consider `.Figure.suptitle`, so it may overlap with
310+
other artists after calling `~.Figure.tight_layout`:
313311

314312
..plot::
315313

@@ -342,18 +340,30 @@ Allow tick formatters to be set with str or function inputs
342340
now accept `str` or function inputs in addition to `~.ticker.Formatter`
343341
instances. For a `str` a `~.ticker.StrMethodFormatter` is automatically
344342
generated and used. For a function a `~.ticker.FuncFormatter` is automatically
345-
generated and used.
343+
generated and used. In other words,
344+
::
345+
346+
ax.xaxis.set_major_formatter('price: {:02}')
347+
ax.xaxis.set_minor_formatter(lambda x, _ : 'low' if x < 2 else 'high')
348+
349+
are shortcuts for::
350+
351+
import matplotlib.ticker as mticker
352+
353+
ax.xaxis.set_major_formatter(mticker.StrMethodFormatter('price: {:02}'))
354+
ax.xaxis.set_minor_formatter(
355+
mticker.FuncFormatter(lambda x, _ : 'low' if x < 2 else 'high'))
346356

347357

348358
Setting axes box aspect
349359
-----------------------
350360

351361
It is now possible to set the aspect of an axes box directly via
352-
`~.Axes.set_box_aspect`. The box aspect is the ratio between axes height
353-
andaxes width in physical units, independent of the data limits.
354-
This is usefulto, e.g., produce a square plot, independent of the data it
355-
contains, or tohave ausual plot with the same axes dimensions next to
356-
an image plot withfixed (data-)aspect.
362+
`~.Axes.set_box_aspect`. The box aspect is the ratio between axes height and
363+
axes width in physical units, independent of the data limits. This is useful
364+
to, e.g., produce a square plot, independent of the data it contains, or to
365+
have anon-image plot with the same axes dimensions next to an image plot with
366+
fixed (data-)aspect.
357367

358368
For use cases check out the:doc:`Axes box aspect
359369
</gallery/subplots_axes_and_figures/axes_box_aspect>` example.
@@ -424,7 +434,30 @@ explicit keyword argument *normalize* has been added. By default, the old
424434
behavior is preserved.
425435

426436
By passing *normalize*, one can explicitly control whether any rescaling takes
427-
place and whether partial pies should be created.
437+
place or whether partial pies should be created. If normalization is disabled,
438+
and ``sum(x) > 1``, then an error is raised.
439+
440+
..plot::
441+
442+
def label(x):
443+
return [str(v) for v in x]
444+
445+
x = np.array([0.25, 0.3, 0.3])
446+
fig, ax = plt.subplots(2, 2, constrained_layout=True)
447+
448+
ax[0, 0].pie(x, autopct='%1.1f%%', labels=label(x), normalize=False)
449+
ax[0, 0].set_title('normalize=False')
450+
ax[0, 1].pie(x, autopct='%1.2f%%', labels=label(x), normalize=True)
451+
ax[0, 1].set_title('normalize=True')
452+
453+
# For the purposes of keeping the documentation build warning-free, and
454+
# future proof for when the deprecation is made permanent, we pass
455+
# *normalize* here explicitly anyway.
456+
ax[1, 0].pie(x, autopct='%1.2f%%', labels=label(x), normalize=False)
457+
ax[1, 0].set_title('normalize unspecified\nsum(x) < 1')
458+
ax[1, 1].pie(x * 10, autopct='%1.2f%%', labels=label(x * 10),
459+
normalize=True)
460+
ax[1, 1].set_title('normalize unspecified\nsum(x) > 1')
428461

429462

430463
Simple syntax to select fonts by absolute path
@@ -445,8 +478,8 @@ accurately.
445478
rcParams improvements
446479
---------------------
447480

448-
``matplotlib.rc_context``is now a ``contextlib.contextmanager``
449-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
481+
``matplotlib.rc_context``can be used as a decorator
482+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
450483

451484
`matplotlib.rc_context` can now be used as a decorator (technically, it is now
452485
implemented as a `contextlib.contextmanager`), e.g., ::
@@ -457,9 +490,10 @@ implemented as a `contextlib.contextmanager`), e.g., ::
457490

458491
rcParams for controlling default "raise window" behavior
459492
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
460-
The new config option:rc:`figure.raise_window` allows to disable
461-
raising the plot window when calling `~.pyplot.show` or `~.pyplot.pause`.
462-
The ``MacOSX`` backend is currently not supported.
493+
494+
The new config option:rc:`figure.raise_window` allows disabling of the raising
495+
of the plot window when calling `~.pyplot.show` or `~.pyplot.pause`. The
496+
``MacOSX`` backend is currently not supported.
463497

464498
Add generalized ``mathtext.fallback`` to rcParams
465499
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp