Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41acef7

Browse files
committed
Updates based on feedback from review
1 parent eeb895c commit 41acef7

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

lib/matplotlib/colorizer.py

Lines changed: 12 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
@@ -921,10 +918,10 @@ def _ensure_multivariate_data(data, n_input):
921918
return data
922919

923920
elif n_input == 2:
924-
raise ValueError("Invalid data entry for mutlivariate data. The data"
921+
raise ValueError("Invalid data entry for multivariate data. The data"
925922
" must contain complex numbers, or have a first dimension 2,"
926923
" or be of a dtype with 2 fields")
927924
else:
928-
raise ValueError("Invalid data entry for mutlivariate data. The shape"
925+
raise ValueError("Invalid data entry for multivariate data. The shape"
929926
f" of the data must have a first dimension {n_input}"
930927
f" or be of a dtype with {n_input} fields")

0 commit comments

Comments
 (0)