@@ -245,9 +245,9 @@ def _revert(self, path, first_action=Path.LINETO):
245
245
#return path
246
246
247
247
@docstring .dedent_interpd
248
- def add (self , patchlabel = '' , flows = np . array ([ 1.0 , - 1.0 ]) ,
249
- orientations = [ 0 , 0 ], labels = '' , trunklength = 1. 0 , pathlengths = 0.25 ,
250
- prior = None , connect = ( 0 , 0 ), rotation = 0 , ** kwargs ):
248
+ def add (self , patchlabel = '' , flows = None , orientations = None , labels = '' ,
249
+ trunklength = 1. 0 , pathlengths = 0.25 , prior = None , connect = ( 0 , 0 ) ,
250
+ rotation = 0 , ** kwargs ):
251
251
"""
252
252
Add a simple Sankey diagram with flows at the same hierarchical level.
253
253
@@ -328,13 +328,18 @@ def add(self, patchlabel='', flows=np.array([1.0, -1.0]),
328
328
:meth:`finish`
329
329
"""
330
330
# Check and preprocess the arguments.
331
- flows = np .array (flows )
331
+ if flows is None :
332
+ flows = np .array ([1.0 , - 1.0 ])
333
+ else :
334
+ flows = np .array (flows )
332
335
n = flows .shape [0 ] # Number of flows
333
336
if rotation == None :
334
337
rotation = 0
335
338
else :
336
339
# In the code below, angles are expressed in deg/90
337
340
rotation /= 90.0
341
+ if orientations is None :
342
+ orientations = [0 , 0 ]
338
343
assert len (orientations ) == n , (
339
344
"orientations and flows must have the same length.\n "
340
345
"orientations has length %d, but flows has length %d."
0 commit comments