Commit fc75b6b 1 parent 6578c48 commit fc75b6b Copy full SHA for fc75b6b
File tree 1 file changed +4
-10
lines changed
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -305,24 +305,18 @@ def combine_cmaps(
305
305
306
306
# Generate default nodes for equal separation
307
307
if nodes is None :
308
- nodes_arr = np .linspace (0 , 1 , len (_cmaps ) + 1 )[1 :- 1 ]
309
- elif isinstance (nodes , list ):
310
- nodes_arr = np .array (nodes )
311
- elif isinstance (nodes , np .ndarray ):
312
- nodes_arr = nodes
308
+ nodes_arr = np .linspace (0 , 1 , len (_cmaps ) + 1 )
309
+ elif isinstance (nodes , (list , np .ndarray )):
310
+ nodes_arr = np .concatenate ([[0.0 ], nodes , [1.0 ]])
313
311
else :
314
312
raise TypeError (f"Unsupported nodes type: { type (nodes )} ." )
315
313
316
314
# Check nodes length
317
- if len (nodes_arr ) != len (_cmaps ) - 1 :
315
+ if len (nodes_arr ) != len (_cmaps ) + 1 :
318
316
raise ValueError (
319
317
"Number of nodes should be one less than the number of colormaps."
320
318
)
321
319
322
- # Insert the start/end points to make segmenting easier
323
- nodes_arr = np .insert (nodes_arr , 0 , 0.0 )
324
- nodes_arr = np .append (nodes_arr , 1.0 )
325
-
326
320
# Check node values
327
321
if any ((nodes_arr < 0 ) | (nodes_arr > 1 )) or any (np .diff (nodes_arr ) <= 0 ):
328
322
raise ValueError (
You can’t perform that action at this time.
0 commit comments