@@ -75,11 +75,11 @@ def _plot_args_replacer(args, data):
7575 except ValueError :
7676 pass
7777 else :
78- msg = "Second argument '{}' is ambiguous: could be a color spec " \
79- "but is in data. Using as data. \n Either rename the " \
80- "entry in data or use three arguments " \
81- " to plot." .format (args [1 ])
82- warnings . warn ( msg , RuntimeWarning , stacklevel = 3 )
78+ warnings . warn (
79+ "Second argument {!r} is ambiguous: could be a color spec but "
80+ "is in data; using as data. Either rename the entry in data "
81+ "or use three arguments to plot." .format (args [1 ]),
82+ RuntimeWarning , stacklevel = 3 )
8383 return ["x" , "y" ]
8484 elif len (args ) == 3 :
8585 return ["x" , "y" , "c" ]
@@ -3391,8 +3391,7 @@ def _update_dict(dictionary, rc_name, properties):
33913391 if usermedians is not None :
33923392 if (len (np .ravel (usermedians )) != len (bxpstats ) or
33933393 np .shape (usermedians )[0 ] != len (bxpstats )):
3394- medmsg = 'usermedians length not compatible with x'
3395- raise ValueError (medmsg )
3394+ raise ValueError ('usermedians length not compatible with x' )
33963395 else :
33973396 # reassign medians as necessary
33983397 for stats , med in zip (bxpstats , usermedians ):
@@ -4032,9 +4031,9 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
40324031 colors = mcolors .to_rgba_array (c )
40334032 except ValueError :
40344033 # c not acceptable as PathCollection facecolor
4035- msg = ("c of shape {0 } not acceptable as a color sequence "
4036- " for x with size {1 }, y with size {2}" )
4037- raise ValueError ( msg .format (c .shape , x .size , y .size ))
4034+ raise ValueError ("c of shape {} not acceptable as a color "
4035+ "sequence for x with size {}, y with size {}"
4036+ .format (c .shape , x .size , y .size ))
40384037 else :
40394038 colors = None # use cmap, norm after collection is created
40404039
@@ -4082,8 +4081,8 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
40824081
40834082 if colors is None :
40844083 if norm is not None and not isinstance (norm , mcolors .Normalize ):
4085- msg = "'norm' must be an instance of 'mcolors.Normalize'"
4086- raise ValueError ( msg )
4084+ raise ValueError (
4085+ "'norm' must be an instance of 'mcolors.Normalize'" )
40874086 collection .set_array (np .asarray (c ))
40884087 collection .set_cmap (cmap )
40894088 collection .set_norm (norm )
@@ -4441,8 +4440,8 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
44414440 accum = bins .searchsorted (accum )
44424441
44434442 if norm is not None and not isinstance (norm , mcolors .Normalize ):
4444- msg = "'norm' must be an instance of 'mcolors.Normalize'"
4445- raise ValueError ( msg )
4443+ raise ValueError (
4444+ "'norm' must be an instance of 'mcolors.Normalize'" )
44464445 collection .set_array (accum )
44474446 collection .set_cmap (cmap )
44484447 collection .set_norm (norm )
@@ -5184,8 +5183,8 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
51845183 self .cla ()
51855184
51865185 if norm is not None and not isinstance (norm , mcolors .Normalize ):
5187- msg = "'norm' must be an instance of 'mcolors.Normalize'"
5188- raise ValueError ( msg )
5186+ raise ValueError (
5187+ "'norm' must be an instance of 'mcolors.Normalize'" )
51895188 if aspect is None :
51905189 aspect = rcParams ['image.aspect' ]
51915190 self .set_aspect (aspect )
@@ -5507,8 +5506,8 @@ def pcolor(self, *args, **kwargs):
55075506 collection .set_alpha (alpha )
55085507 collection .set_array (C )
55095508 if norm is not None and not isinstance (norm , mcolors .Normalize ):
5510- msg = "'norm' must be an instance of 'mcolors.Normalize'"
5511- raise ValueError ( msg )
5509+ raise ValueError (
5510+ "'norm' must be an instance of 'mcolors.Normalize'" )
55125511 collection .set_cmap (cmap )
55135512 collection .set_norm (norm )
55145513 collection .set_clim (vmin , vmax )
@@ -5656,8 +5655,8 @@ def pcolormesh(self, *args, **kwargs):
56565655 collection .set_alpha (alpha )
56575656 collection .set_array (C )
56585657 if norm is not None and not isinstance (norm , mcolors .Normalize ):
5659- msg = "'norm' must be an instance of 'mcolors.Normalize'"
5660- raise ValueError ( msg )
5658+ raise ValueError (
5659+ "'norm' must be an instance of 'mcolors.Normalize'" )
56615660 collection .set_cmap (cmap )
56625661 collection .set_norm (norm )
56635662 collection .set_clim (vmin , vmax )
@@ -5780,8 +5779,8 @@ def pcolorfast(self, *args, **kwargs):
57805779 vmin = kwargs .pop ('vmin' , None )
57815780 vmax = kwargs .pop ('vmax' , None )
57825781 if norm is not None and not isinstance (norm , mcolors .Normalize ):
5783- msg = "'norm' must be an instance of 'mcolors.Normalize'"
5784- raise ValueError ( msg )
5782+ raise ValueError (
5783+ "'norm' must be an instance of 'mcolors.Normalize'" )
57855784
57865785 C = args [- 1 ]
57875786 nr , nc = C .shape
0 commit comments