Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b9f77d

Browse files
committed
Remove the mutable kward from sankey.add. Fixes #563.
1 parent 4cf846d commit 4b9f77d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/matplotlib/sankey.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ def _revert(self, path, first_action=Path.LINETO):
245245
#return path
246246

247247
@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=[0, 0], labels='',
249+
trunklength=1.0, pathlengths=0.25, prior=None, connect=(0, 0),
250+
rotation=0, **kwargs):
251251
"""
252252
Add a simple Sankey diagram with flows at the same hierarchical level.
253253
@@ -328,7 +328,10 @@ def add(self, patchlabel='', flows=np.array([1.0, -1.0]),
328328
:meth:`finish`
329329
"""
330330
# 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)
332335
n = flows.shape[0] # Number of flows
333336
if rotation == None:
334337
rotation = 0

0 commit comments

Comments
 (0)