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

Commite30e7e6

Browse files
committed
More feedback from@story645
1 parent3e4b469 commite30e7e6

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

‎lib/matplotlib/colorizer.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def set_clim(self, vmin=None, vmax=None):
249249
The limits.
250250
251251
For scalar data, the limits may also be passed as a
252-
tuple (*vmin*, *vmax*)as asingle positional argument.
252+
tuple (*vmin*, *vmax*) single positional argument.
253253
254254
.. ACCEPTS: (vmin: float, vmax: float)
255255
"""
@@ -575,14 +575,10 @@ def set_array(self, A):
575575

576576
A=cbook.safe_masked_invalid(A,copy=True)
577577
ifnotnp.can_cast(A.dtype,float,"same_kind"):
578-
ifA.dtype.fieldsisNone:
579-
raiseTypeError(f"Image data of dtype{A.dtype} cannot be "
580-
f"converted to float")
581-
else:
582-
forkeyinA.dtype.fields:
583-
ifnotnp.can_cast(A[key].dtype,float,"same_kind"):
584-
raiseTypeError(f"Image data of dtype{A.dtype} cannot be "
585-
f"converted to a sequence of floats")
578+
forkeyinnp.atleast_1d(A.dtype.fields):
579+
ifnotnp.can_cast(A[key].dtype,float,"same_kind"):
580+
raiseTypeError(f"Image data of dtype{A.dtype} cannot be "
581+
f"converted to a sequence of floats")
586582

587583
self._A=A
588584
ifnotself.norm.scaled():
@@ -635,7 +631,7 @@ def _get_colorizer(cmap, norm, colorizer):
635631
cmap : str, `~matplotlib.colors.Colormap`, `~matplotlib.colors.BivarColormap`\
636632
or `~matplotlib.colors.MultivarColormap`, default: :rc:`image.cmap`
637633
The Colormap instance or registered colormap name used to map
638-
scalar/multivariatedata to colors.
634+
data values to colors.
639635
640636
Multivariate data is only accepted if a multivariate colormap
641637
(`~matplotlib.colors.BivarColormap` or `~matplotlib.colors.MultivarColormap`)
@@ -660,13 +656,13 @@ def _get_colorizer(cmap, norm, colorizer):
660656
before mapping to colors using *cmap*. By default, a linear scaling is
661657
used, mapping the lowest value to 0 and the highest to 1.
662658
663-
If given, this can be one of the following:
659+
This can be one of the following:
664660
665661
- An instance of `.Normalize` or one of its subclasses
666662
(see :ref:`colormapnorms`).
667663
- A scale name, i.e. one of "linear", "log", "symlog", "logit", etc. For a
668664
list of available scales, call `matplotlib.scale.get_scale_names()`.
669-
Inthat case, a suitable `.Normalize` subclass is dynamically generated
665+
Inthis case, a suitable `.Normalize` subclass is dynamically generated
670666
and instantiated.
671667
- A list of scale names or `.Normalize` objects matching the number of
672668
variates in the colormap, for use with `~matplotlib.colors.BivarColormap`
@@ -686,8 +682,8 @@ def _get_colorizer(cmap, norm, colorizer):
686682
*vmin*/*vmax* when a *norm* instance is given (but using a `str` *norm*
687683
name together with *vmin*/*vmax* is acceptable).
688684
689-
A list can be used to define independent limits for each variate when
690-
using a `~matplotlib.colors.BivarColormap` or
685+
A listof values (vmin or vmax)can be used to define independent limits
686+
for each variate whenusing a `~matplotlib.colors.BivarColormap` or
691687
`~matplotlib.colors.MultivarColormap`.""",
692688
)
693689

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp