@@ -211,8 +211,8 @@ def to_rgba_array(c, alpha=None):
211
211
# Special-case inputs that are already arrays, for performance. (If the
212
212
# array has the wrong kind or shape, raise the error during one-at-a-time
213
213
# conversion.)
214
- if (isinstance (c , np .ndarray ) and c .dtype .kind in "if"
215
- and c .ndim == 2 and c .shape [1 ] in [3 , 4 ]):
214
+ if (isinstance (c , np .ndarray ) and c .dtype .kind in "if" and
215
+ c .ndim == 2 and c .shape [1 ] in [3 , 4 ]):
216
216
if c .shape [1 ] == 3 :
217
217
result = np .column_stack ([c , np .zeros (len (c ))])
218
218
result [:, - 1 ] = alpha if alpha is not None else 1.
@@ -778,7 +778,7 @@ def join(self, other, name=None, frac_self=None, N=None):
778
778
if name is None :
779
779
name = '{}+{}' .format (self .name , other .name )
780
780
assert 0 < frac_self and frac_self < 1 , (
781
- "The parameter `` frac_self`` must be in the interval `` (0.0, 1.0)`` ."
781
+ "The parameter frac_self must be in the interval (0.0, 1.0)."
782
782
)
783
783
map0 = self (np .linspace (0 , 1 , int (N * frac_self )))
784
784
map1 = other (np .linspace (0 , 1 , int (N * (1 - frac_self ))))
@@ -819,11 +819,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
819
819
cmap_trunc = cmap.truncate(0.2, 0.7)
820
820
821
821
"""
822
- assert minval < maxval , "`` minval`` must be less than `` maxval`` "
822
+ assert minval < maxval , "minval must be less than maxval"
823
823
assert 0 <= minval and minval < 1 , (
824
- "The parameter `` minval`` must be in the interval `` (0.0, 1.0)`` ." )
824
+ "The parameter minval must be in the interval (0.0, 1.0)." )
825
825
assert 0 < maxval and maxval <= 1 , (
826
- "The parameter `` maxval`` must be in the interval `` (0.0, 1.0)`` ." )
826
+ "The parameter maxval must be in the interval (0.0, 1.0)." )
827
827
assert minval != 0 or maxval != 1 , (
828
828
"This is not a truncation." )
829
829
# This was taken largely from
@@ -833,7 +833,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
833
833
if N is None :
834
834
N = np .ceil (self .N * (maxval - minval ))
835
835
name = "trunc({},{:.2f},{:.2f})" .format (self .name , minval , maxval )
836
- return LinearSegmentedColormap .from_list (name , self (np .linspace (minval , maxval , N )), N )
836
+ return LinearSegmentedColormap .from_list (name ,
837
+ self (np .linspace (minval ,
838
+ maxval ,
839
+ N )),
840
+ N )
837
841
838
842
839
843
class ListedColormap (Colormap ):
@@ -964,7 +968,7 @@ def join(self, other, name=None, frac_self=None, N=None):
964
968
if name is None :
965
969
name = '{}+{}' .format (self .name , other .name )
966
970
assert 0 < frac_self and frac_self < 1 , (
967
- "The parameter `` frac_self`` must be in the interval `` (0.0, 1.0)`` ."
971
+ "The parameter frac_self must be in the interval (0.0, 1.0)."
968
972
)
969
973
map0 = self (np .linspace (0 , 1 , int (N * frac_self )))
970
974
map1 = other (np .linspace (0 , 1 , int (N * (1 - frac_self ))))
@@ -1005,11 +1009,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
1005
1009
cmap_trunc = cmap.truncate(0.2, 0.7)
1006
1010
1007
1011
"""
1008
- assert minval < maxval , "`` minval`` must be less than `` maxval`` "
1012
+ assert minval < maxval , "minval must be less than maxval"
1009
1013
assert 0 <= minval and minval < 1 , (
1010
- "The parameter `` minval`` must be in the interval `` (0.0, 1.0)`` ." )
1014
+ "The parameter minval must be in the interval (0.0, 1.0)." )
1011
1015
assert 0 < maxval and maxval <= 1 , (
1012
- "The parameter `` maxval`` must be in the interval `` (0.0, 1.0)`` ." )
1016
+ "The parameter maxval must be in the interval (0.0, 1.0)." )
1013
1017
assert minval != 0 or maxval != 1 , (
1014
1018
"This is not a truncation." )
1015
1019
# This was taken largely from
@@ -1244,7 +1248,7 @@ def __init__(self, linthresh, linscale=1.0,
1244
1248
"""
1245
1249
Normalize .__init__ (self , vmin , vmax , clip )
1246
1250
self .linthresh = float (linthresh )
1247
- self ._linscale_adj = (linscale / (1.0 - np .e ** - 1 ))
1251
+ self ._linscale_adj = (linscale / (1.0 - np .e ** - 1 ))
1248
1252
if vmin is not None and vmax is not None :
1249
1253
self ._transform_vmin_vmax ()
1250
1254
@@ -1280,7 +1284,7 @@ def _transform(self, a):
1280
1284
"""
1281
1285
masked = np .abs (a ) > self .linthresh
1282
1286
sign = np .sign (a [masked ])
1283
- log = (self ._linscale_adj + np .log (np .abs (a [masked ]) / self .linthresh ))
1287
+ log = (self ._linscale_adj + np .log (np .abs (a [masked ]) / self .linthresh ))
1284
1288
log *= sign * self .linthresh
1285
1289
a [masked ] = log
1286
1290
a [~ masked ] *= self ._linscale_adj
0 commit comments