@@ -370,10 +370,9 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
370
370
By convention, inputs are positive and outputs are
371
371
negative.
372
372
*orientations* list of orientations of the paths
373
- Valid values are 1 (from/to the top), 0 (from/to
374
- the left or right), or -1 (from/to the bottom). If
375
- *orientations* == 0, inputs will break in from the
376
- left and outputs will break away to the right.
373
+ Valid values are 0 (inputs from the left, outputs
374
+ to the right), 1 (from and to the top) or -1 (from
375
+ and to the bottom).
377
376
*labels* list of specifications of the labels for the flows
378
377
Each value may be *None* (no labels), '' (just
379
378
label the quantities), or a labeling string. If a
@@ -443,12 +442,14 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
443
442
# In the code below, angles are expressed in deg/90.
444
443
rotation /= 90.0
445
444
if orientations is None :
446
- orientations = [0 , 0 ]
447
- if len (orientations ) != n :
445
+ orientations = 0
446
+ try :
447
+ orientations = np .broadcast_to (orientations , n )
448
+ except ValueError :
448
449
raise ValueError (
449
- "orientations and flows must have the same length. \n "
450
- "orientations has length %d, but flows has length %d. "
451
- % ( len ( orientations ), n ))
450
+ f"The shapes of 'flows' { np . shape ( flows ) } and 'orientations' "
451
+ f" { np . shape ( orientations ) } are incompatible "
452
+ ) from None
452
453
if not cbook .is_scalar_or_string (labels ) and len (labels ) != n :
453
454
raise ValueError (
454
455
"If labels is a list, then labels and flows must have the "
0 commit comments