@@ -232,8 +232,8 @@ def to_rgba_array(c, alpha=None):
232
232
# Special-case inputs that are already arrays, for performance. (If the
233
233
# array has the wrong kind or shape, raise the error during one-at-a-time
234
234
# conversion.)
235
- if (isinstance (c , np .ndarray ) and c .dtype .kind in "if"
236
- and c .ndim == 2 and c .shape [1 ] in [3 , 4 ]):
235
+ if (isinstance (c , np .ndarray ) and c .dtype .kind in "if" and
236
+ c .ndim == 2 and c .shape [1 ] in [3 , 4 ]):
237
237
if c .shape [1 ] == 3 :
238
238
result = np .column_stack ([c , np .zeros (len (c ))])
239
239
result [:, - 1 ] = alpha if alpha is not None else 1.
@@ -799,7 +799,7 @@ def join(self, other, name=None, frac_self=None, N=None):
799
799
if name is None :
800
800
name = '{}+{}' .format (self .name , other .name )
801
801
assert 0 < frac_self and frac_self < 1 , (
802
- "The parameter `` frac_self`` must be in the interval `` (0.0, 1.0)`` ."
802
+ "The parameter frac_self must be in the interval (0.0, 1.0)."
803
803
)
804
804
map0 = self (np .linspace (0 , 1 , int (N * frac_self )))
805
805
map1 = other (np .linspace (0 , 1 , int (N * (1 - frac_self ))))
@@ -840,11 +840,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
840
840
cmap_trunc = cmap.truncate(0.2, 0.7)
841
841
842
842
"""
843
- assert minval < maxval , "`` minval`` must be less than `` maxval`` "
843
+ assert minval < maxval , "minval must be less than maxval"
844
844
assert 0 <= minval and minval < 1 , (
845
- "The parameter `` minval`` must be in the interval `` (0.0, 1.0)`` ." )
845
+ "The parameter minval must be in the interval (0.0, 1.0)." )
846
846
assert 0 < maxval and maxval <= 1 , (
847
- "The parameter `` maxval`` must be in the interval `` (0.0, 1.0)`` ." )
847
+ "The parameter maxval must be in the interval (0.0, 1.0)." )
848
848
assert minval != 0 or maxval != 1 , (
849
849
"This is not a truncation." )
850
850
# This was taken largely from
@@ -854,7 +854,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
854
854
if N is None :
855
855
N = np .ceil (self .N * (maxval - minval ))
856
856
name = "trunc({},{:.2f},{:.2f})" .format (self .name , minval , maxval )
857
- return LinearSegmentedColormap .from_list (name , self (np .linspace (minval , maxval , N )), N )
857
+ return LinearSegmentedColormap .from_list (name ,
858
+ self (np .linspace (minval ,
859
+ maxval ,
860
+ N )),
861
+ N )
858
862
859
863
860
864
class ListedColormap (Colormap ):
@@ -982,7 +986,7 @@ def join(self, other, name=None, frac_self=None, N=None):
982
986
if name is None :
983
987
name = '{}+{}' .format (self .name , other .name )
984
988
assert 0 < frac_self and frac_self < 1 , (
985
- "The parameter `` frac_self`` must be in the interval `` (0.0, 1.0)`` ."
989
+ "The parameter frac_self must be in the interval (0.0, 1.0)."
986
990
)
987
991
map0 = self (np .linspace (0 , 1 , int (N * frac_self )))
988
992
map1 = other (np .linspace (0 , 1 , int (N * (1 - frac_self ))))
@@ -1023,11 +1027,11 @@ def truncate(self, minval=0.0, maxval=1.0, N=None):
1023
1027
cmap_trunc = cmap.truncate(0.2, 0.7)
1024
1028
1025
1029
"""
1026
- assert minval < maxval , "`` minval`` must be less than `` maxval`` "
1030
+ assert minval < maxval , "minval must be less than maxval"
1027
1031
assert 0 <= minval and minval < 1 , (
1028
- "The parameter `` minval`` must be in the interval `` (0.0, 1.0)`` ." )
1032
+ "The parameter minval must be in the interval (0.0, 1.0)." )
1029
1033
assert 0 < maxval and maxval <= 1 , (
1030
- "The parameter `` maxval`` must be in the interval `` (0.0, 1.0)`` ." )
1034
+ "The parameter maxval must be in the interval (0.0, 1.0)." )
1031
1035
assert minval != 0 or maxval != 1 , (
1032
1036
"This is not a truncation." )
1033
1037
# This was taken largely from
0 commit comments