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

Commit9bbba95

Browse files
UFEddyQuLogic
authored andcommitted
Remove deprecated register_cmap, unregister_cmap, and get_cmap
- deprecated cm api removal documentation- Corrected formatting issues with documentation- Removed corresponding type sub in related cm.pyi file and exceptions in mypy-stubtest- Removed tests, updated documentation with code style for removed functions, moved code to pyplot from cm- Revert "Removed tests, updated documentation with code style for removed functions, moved code to pyplot from cm" This reverts commita8a4f7f.- Documetation updates to match code style for deprecated api's- Removed tests for deprecated api's- Corrected documentation with full path and verbiage on removals- Removed handling of override builtin from ColorMaRegistry
1 parent3ad0bc5 commit9bbba95

File tree

15 files changed

+72
-234
lines changed

15 files changed

+72
-234
lines changed

‎ci/mypy-stubtest-allowlist.txt‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ matplotlib.figure.Figure.set_constrained_layout
3737
matplotlib.figure.Figure.set_constrained_layout_pads
3838
matplotlib.figure.Figure.set_tight_layout
3939

40-
# 3.7 deprecations
41-
matplotlib.cm.register_cmap
42-
matplotlib.cm.unregister_cmap
43-
4440
# positional-only argument name lacking leading underscores
4541
matplotlib.axes._base._AxesBase.axis
4642

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
As part of the `multi-step refactoring of colormap registration
2+
<https://github.com/matplotlib/matplotlib/issues/20853>`_, the following functions have
3+
been removed:
4+
5+
- ``matplotlib.cm.get_cmap``; use ``matplotlib.colormaps[name]`` instead if you
6+
have a `str`.
7+
8+
Use `matplotlib.cm.ColormapRegistry.get_cmap` if you have a `str`, `None` or a
9+
`matplotlib.colors.Colormap` object that you want to convert to a `.Colormap`
10+
object.
11+
- ``matplotlib.cm.register_cmap``; use `matplotlib.colormaps.register
12+
<.ColormapRegistry.register>` instead.
13+
- ``matplotlib.cm.unregister_cmap``; use `matplotlib.colormaps.unregister
14+
<.ColormapRegistry.unregister>` instead.
15+
- ``matplotlib.pyplot.register_cmap``; use `matplotlib.colormaps.register
16+
<.ColormapRegistry.register>` instead.
17+
18+
The `matplotlib.pyplot.get_cmap` function will stay available for backward
19+
compatibility.

‎doc/api/prev_api_changes/api_changes_0.99.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Changes in 0.99
77
NumPy arrays.
88

99
* User-generated colormaps can now be added to the set recognized
10-
by:func:`matplotlib.cm.get_cmap`. Colormaps can be made the
10+
by``matplotlib.cm.get_cmap``. Colormaps can be made the
1111
default and applied to the current image using
1212
:func:`matplotlib.pyplot.set_cmap`.
1313

‎doc/api/prev_api_changes/api_changes_3.2.0/behavior.rst‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,11 @@ Exception changes
294294
~~~~~~~~~~~~~~~~~
295295
Various APIs that raised a `ValueError` for incorrectly typed inputs now raise
296296
`TypeError` instead: `.backend_bases.GraphicsContextBase.set_clip_path`,
297-
``blocking_input.BlockingInput.__call__``, `.cm.register_cmap`, `.dviread.DviFont`,
298-
`.rcsetup.validate_hatch`, ``.rcsetup.validate_animation_writer_path``, `.spines.Spine`,
299-
many classes in the:mod:`matplotlib.transforms` module and:mod:`matplotlib.tri`
300-
package, and Axes methods that take a ``norm`` parameter.
297+
``blocking_input.BlockingInput.__call__``, ``matplotlib.cm.register_cmap``,
298+
`.dviread.DviFont`, `.rcsetup.validate_hatch`,
299+
``.rcsetup.validate_animation_writer_path``, `.spines.Spine`, many classes in
300+
the:mod:`matplotlib.transforms` module and:mod:`matplotlib.tri` package, and
301+
Axes methods that take a ``norm`` parameter.
301302

302303
If extra kwargs are passed to `.LogScale`, `TypeError` will now be
303304
raised instead of `ValueError`.

‎doc/api/prev_api_changes/api_changes_3.3.0/deprecations.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Please pass capstyles ("miter", "round", "bevel") and joinstyles ("butt",
5555

5656
Passing raw data to ``register_cmap()``
5757
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58-
Passing raw data via parameters *data* and *lut* to `.register_cmap()` is
58+
Passing raw data via parameters *data* and *lut* to ``matplotlib.cm.register_cmap()`` is
5959
deprecated. Instead, explicitly create a `.LinearSegmentedColormap` and pass
6060
it via the *cmap* parameter:
6161
``register_cmap(cmap=LinearSegmentedColormap(name, data, lut))``.

‎doc/api/prev_api_changes/api_changes_3.4.0/behaviour.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ time, not at draw time.
203203
Raise or warn on registering a colormap twice
204204
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205205

206-
When using `matplotlib.cm.register_cmap` to register a user provided or
206+
When using ``matplotlib.cm.register_cmap`` to register a user provided or
207207
third-party colormap it will now raise a `ValueError` if trying to over-write
208208
one of the built in colormaps and warn if trying to over write a user
209209
registered colormap. This may raise for user-registered colormaps in the

‎doc/api/prev_api_changes/api_changes_3.6.0/behaviour.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Behaviour changes
44
``plt.get_cmap`` and ``matplotlib.cm.get_cmap`` return a copy
55
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66

7-
Formerly, `~.pyplot.get_cmap` and `.cm.get_cmap` returned a global version of a
8-
`.Colormap`. This was prone to errors as modification of the colormap would
9-
propagate from one location to another without warning. Now, a new copy of the
10-
colormapis returned.
7+
Formerly, `~.pyplot.get_cmap` and ``matplotlib.cm.get_cmap`` returned a global version
8+
of a`.Colormap`. This was prone to errors as modification of the colormap would
9+
propagate from one location to another without warning. Now, a new copy of the colormap
10+
is returned.
1111

1212
Large ``imshow`` images are now downsampled
1313
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

‎doc/api/prev_api_changes/api_changes_3.7.0/behaviour.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ also be based on ``mpl_toolkits.axisartist``. This behavior is consistent with
2020
``plt.get_cmap`` and ``matplotlib.cm.get_cmap`` return a copy
2121
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2222

23-
Formerly, `~.pyplot.get_cmap` and `.cm.get_cmap` returned a global version of a
24-
`.Colormap`. This was prone to errors as modification of the colormap would
25-
propagate from one location to another without warning. Now, a new copy of the
26-
colormapis returned.
23+
Formerly, `~.pyplot.get_cmap` and ``matplotlib.cm.get_cmap`` returned a global version
24+
of a`.Colormap`. This was prone to errors as modification of the colormap would
25+
propagate from one location to another without warning. Now, a new copy of the colormap
26+
is returned.
2727

2828
``TrapezoidMapTriFinder`` uses different random number generator
2929
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ for out-of-range and masked values.
547547
New ``cm.unregister_cmap`` function
548548
-----------------------------------
549549

550-
`.cm.unregister_cmap` allows users to remove a colormap that they have
550+
``matplotlib.cm.unregister_cmap`` allows users to remove a colormap that they have
551551
previously registered.
552552

553553
New ``CenteredNorm`` for symmetrical data around a center

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ To register new colormaps use::
148148

149149
plt.colormaps.register(my_colormap)
150150

151-
We recommend to use the new API instead of the `~.cm.get_cmap` and
152-
`~.cm.register_cmap` functions for new code. `matplotlib.cm.get_cmap` and
153-
`matplotlib.cm.register_cmap` will eventually be deprecated and removed.
151+
We recommend to use the new API instead of the ``matplotlib.cm.get_cmap`` and
152+
``matplotlib.cm.register_cmap`` functions for new code. ``matplotlib.cm.get_cmap`` and
153+
``matplotlib.cm.register_cmap`` will eventually be deprecated and removed.
154154
Within `.pyplot`, ``plt.get_cmap()`` and ``plt.register_cmap()`` will continue
155155
to be supported for backward compatibility.
156156

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp