@@ -249,7 +249,7 @@ def set_clim(self, vmin=None, vmax=None):
249
249
The limits.
250
250
251
251
For scalar data, the limits may also be passed as a
252
- tuple (*vmin*, *vmax*)as a single positional argument.
252
+ tuple (*vmin*, *vmax*) single positional argument.
253
253
254
254
.. ACCEPTS: (vmin: float, vmax: float)
255
255
"""
@@ -575,14 +575,10 @@ def set_array(self, A):
575
575
576
576
A = cbook .safe_masked_invalid (A ,copy = True )
577
577
if not np .can_cast (A .dtype ,float ,"same_kind" ):
578
- if A .dtype .fields is None :
579
- raise TypeError (f"Image data of dtype{ A .dtype } cannot be "
580
- f"converted to float" )
581
- else :
582
- for key in A .dtype .fields :
583
- if not np .can_cast (A [key ].dtype ,float ,"same_kind" ):
584
- raise TypeError (f"Image data of dtype{ A .dtype } cannot be "
585
- f"converted to a sequence of floats" )
578
+ for key in np .atleast_1d (A .dtype .fields ):
579
+ if not np .can_cast (A [key ].dtype ,float ,"same_kind" ):
580
+ raise TypeError (f"Image data of dtype{ A .dtype } cannot be "
581
+ f"converted to a sequence of floats" )
586
582
587
583
self ._A = A
588
584
if not self .norm .scaled ():
@@ -635,7 +631,7 @@ def _get_colorizer(cmap, norm, colorizer):
635
631
cmap : str, `~matplotlib.colors.Colormap`, `~matplotlib.colors.BivarColormap`\
636
632
or `~matplotlib.colors.MultivarColormap`, default: :rc:`image.cmap`
637
633
The Colormap instance or registered colormap name used to map
638
- scalar/multivariate data to colors.
634
+ data values to colors.
639
635
640
636
Multivariate data is only accepted if a multivariate colormap
641
637
(`~matplotlib.colors.BivarColormap` or `~matplotlib.colors.MultivarColormap`)
@@ -660,13 +656,13 @@ def _get_colorizer(cmap, norm, colorizer):
660
656
before mapping to colors using *cmap*. By default, a linear scaling is
661
657
used, mapping the lowest value to 0 and the highest to 1.
662
658
663
- If given, this can be one of the following:
659
+ This can be one of the following:
664
660
665
661
- An instance of `.Normalize` or one of its subclasses
666
662
(see :ref:`colormapnorms`).
667
663
- A scale name, i.e. one of "linear", "log", "symlog", "logit", etc. For a
668
664
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
670
666
and instantiated.
671
667
- A list of scale names or `.Normalize` objects matching the number of
672
668
variates in the colormap, for use with `~matplotlib.colors.BivarColormap`
@@ -686,8 +682,8 @@ def _get_colorizer(cmap, norm, colorizer):
686
682
*vmin*/*vmax* when a *norm* instance is given (but using a `str` *norm*
687
683
name together with *vmin*/*vmax* is acceptable).
688
684
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 when using a `~matplotlib.colors.BivarColormap` or
691
687
`~matplotlib.colors.MultivarColormap`.""" ,
692
688
)
693
689