8000 Updates based on feedback from review · matplotlib/matplotlib@9c62126 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9c62126

Browse files
committed
Updates based on feedback from review
1 parent eeb895c commit 9c62126

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

lib/matplotlib/colorizer.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _scale_norm(self, norm, vmin, vmax, A):
7878
raise ValueError(
7979
"Passing a Normalize instance simultaneously with "
8080
"vmin/vmax is not supported. Please pass vmin/vmax "
81-
"directly to the norm when creating it.")
81+
"directly to the norm when creating it")
8282

8383
# always resolve the autoscaling so we have concrete limits
8484
# rather than deferring to draw time.
@@ -174,7 +174,7 @@ def _pass_image_data(x, alpha=None, bytes=False, norm=True):
174174

175175
if norm and (xx.max() > 1 or xx.min() < 0):
176176
raise ValueError("Floating point image RGB values "
177-
"must be in the 0..1 range.")
177+
"must be in the 0..1 range")
178178
if bytes:
179179
xx = (xx * 255).astype(np.uint8)
180180
elif xx.dtype == np.uint8:
@@ -226,7 +226,7 @@ def _set_cmap(self, cmap):
226226
if self.norm.n_output != cmap_obj.n_variates:
227227
raise ValueError(f"The colormap {cmap} does not support "
228228
f"{self.norm.n_output} variates as required by "
229-
f"the {type(self.norm)} on this Colorizer.")
229+
f"the {type(self.norm)} on this Colorizer")
230230
self._cmap = cmap_obj
231231
if not in_init:
232232
self.changed() # Things are not set up properly yet.
@@ -788,7 +788,7 @@ def _ensure_norm(norm, n_variates=1):
788788
return norm
789789
raise ValueError(
790790
"Invalid norm for multivariate colormap with "
791-
f"{n_variates} inputs."
791+
f"{n_variates} inputs"
792792
)
793793

794794

@@ -840,15 +840,12 @@ def _ensure_cmap(cmap, accept_multivariate=False):
840840

841841
# this error message is a variant of _api.check_in_list but gives
842842
# additional hints as to how to access multivariate colormaps
843-
844-
msg = f"{cmap!r} is not a valid value for cmap"
845-
msg += "; supported values for scalar colormaps are "
846-
msg += f"{', '.join(map(repr, sorted(mpl.colormaps)))}\n"
847-
msg += "See matplotlib.bivar_colormaps() and"
848-
msg += " matplotlib.multivar_colormaps() for"
849-
msg += " bivariate and multivariate colormaps."
850-
851-
raise ValueError(msg)
843+
raise ValueError(f"{cmap!r} is not a valid value for cmap"
844+
"; supported values for scalar colormaps are "
845+
f"{', '.join(map(repr, sorted(mpl.colormaps)))}\n"
846+
"See `matplotlib.bivar_colormaps()` and"
847+
" `matplotlib.multivar_colormaps()` for"
848+
" bivariate and multivariate colormaps")
852849

853850
if isinstance(cmap, colors.Colormap):
854851
return cmap
@@ -870,11 +867,13 @@ def _ensure_multivariate_data(data, n_input):
870867
If n_input is 1 and data is not of type np.ndarray (i.e. PIL.Image),
871868
the data is returned unchanged.
872869
If data is None, the function returns None
870+
873871
Parameters
874872
----------
875873
n_input : int
876874
- number of variates in the data
877875
data : np.ndarray, PIL.Image or None
876+
878877
Returns
879878
-------
880879
np.ndarray, PIL.Image or None
@@ -921,10 +920,10 @@ def _ensure_multivariate_data(data, n_input):
921920
return data
922921

923922
elif n_input == 2:
924-
raise ValueError("Invalid data entry for mutlivariate data. The data"
923+
raise ValueError("Invalid data entry for multivariate data. The data"
925924
" must contain complex numbers, or have a first dimension 2,"
926925
" or be of a dtype with 2 fields")
927926
else:
928-
raise ValueError("Invalid data entry for mutlivariate data. The shape"
927+
raise ValueError("Invalid data entry for multivariate data. The shape"
929928
f" of the data must have a first dimension {n_input}"
930929
f" or be of a dtype with {n_input} fields")

0 commit comments

Comments
 (0)
0