Skip to content

Commit 7261ab8

Browse files
committed
numpydocify Sankey.add.
Note that the previously stated default facecolor and linewidth only apply in _internal.classic_mode, so don't need to be mentioned.
1 parent ddd82b5 commit 7261ab8

File tree

1 file changed

+75
-72
lines changed

1 file changed

+75
-72
lines changed

lib/matplotlib/sankey.py

Lines changed: 75 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -355,81 +355,84 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
355355
"""
356356
Add a simple Sankey diagram with flows at the same hierarchical level.
357357
358-
Return value is the instance of :class:`Sankey`.
359-
360-
Optional keyword arguments:
361-
362-
=============== ===================================================
363-
Keyword Description
364-
=============== ===================================================
365-
*patchlabel* label to be placed at the center of the diagram
366-
Note: *label* (not *patchlabel*) will be passed to
367-
the patch through ``**kwargs`` and can be used to
368-
create an entry in the legend.
369-
*flows* array of flow values
370-
By convention, inputs are positive and outputs are
371-
negative.
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.
377-
*labels* list of specifications of the labels for the flows
378-
Each value may be *None* (no labels), '' (just
379-
label the quantities), or a labeling string. If a
380-
single value is provided, it will be applied to all
381-
flows. If an entry is a non-empty string, then the
382-
quantity for the corresponding flow will be shown
383-
below the string. However, if the *unit* of the
384-
main diagram is None, then quantities are never
385-
shown, regardless of the value of this argument.
386-
*trunklength* length between the bases of the input and output
387-
groups
388-
*pathlengths* list of lengths of the arrows before break-in or
389-
after break-away
390-
If a single value is given, then it will be applied
391-
to the first (inside) paths on the top and bottom,
392-
and the length of all other arrows will be
393-
justified accordingly. The *pathlengths* are not
394-
applied to the horizontal inputs and outputs.
395-
*prior* index of the prior diagram to which this diagram
396-
should be connected
397-
*connect* a (prior, this) tuple indexing the flow of the
398-
prior diagram and the flow of this diagram which
399-
should be connected
400-
If this is the first diagram or *prior* is *None*,
401-
*connect* will be ignored.
402-
*rotation* angle of rotation of the diagram [deg]
403-
*rotation* is ignored if this diagram is connected
404-
to an existing one (using *prior* and *connect*).
405-
The interpretation of the *orientations* argument
406-
will be rotated accordingly (e.g., if *rotation*
407-
== 90, an *orientations* entry of 1 means to/from
408-
the left).
409-
=============== ===================================================
410-
411-
Valid kwargs are :meth:`matplotlib.patches.PathPatch` arguments:
358+
Parameters
359+
----------
360+
patchlabel : str
361+
Label to be placed at the center of the diagram.
362+
Note that *label* (not *patchlabel*) will be passed to the patch
363+
through ``**kwargs`` and can be used to create an entry in the
364+
legend.
365+
366+
flows : list of float
367+
Array of flow values. By convention, inputs are positive and
368+
outputs are negative.
369+
370+
The flows are placed along the top of the diagram from the inside
371+
out in order of their index within the *flows* list or array. They
372+
are placed along the sides of the diagram from the top down and
373+
along the bottom from the outside in.
374+
375+
If the sum of the inputs and outputs is
376+
nonzero, the discrepancy will appear as a cubic Bezier curve along
377+
the top and bottom edges of the trunk.
378+
379+
orientations : list of {-1, 0, 1}
380+
List of orientations of the flows (or a single orientation to be
381+
used for all flows). Valid values are 0 (inputs from
382+
the left, outputs to the right), 1 (from and to the top) or -1
383+
(from and to the bottom).
384+
385+
labels : list of (str or None)
386+
List of labels for the flows (or a single label to be used for all
387+
flows). Each label may be *None* (no label), or a labeling string.
388+
If an entry is a (possibly empty) string, then the quantity for the
389+
corresponding flow will be shown below the string. However, if
390+
the *unit* of the main diagram is None, then quantities are never
391+
shown, regardless of the value of this argument.
392+
393+
trunklength : float
394+
Length between the bases of the input and output groups.
395+
396+
pathlengths : list of float
397+
List of lengths of the vertical arrows before break-in or after
398+
break-away. If a single value is given, then it will be applied to
399+
the first (inside) paths on the top and bottom, and the length of
400+
all other arrows will be justified accordingly. The *pathlengths*
401+
are not applied to the horizontal inputs and outputs.
402+
403+
prior : int
404+
Index of the prior diagram to which this diagram should be
405+
connected.
406+
407+
connect : (int, int)
408+
A (prior, this) tuple indexing the flow of the prior diagram and
409+
the flow of this diagram which should be connected. If this is the
410+
first diagram or *prior* is *None*, *connect* will be ignored.
411+
412+
rotation : float
413+
Angle of rotation of the diagram in degrees. The interpretation of
414+
the *orientations* argument will be rotated accordingly (e.g., if
415+
*rotation* == 90, an *orientations* entry of 1 means to/from the
416+
left). *rotation* is ignored if this diagram is connected to an
417+
existing one (using *prior* and *connect*).
418+
419+
Returns
420+
-------
421+
Sankey
422+
The current `.Sankey` instance.
423+
424+
Other Parameters
425+
----------------
426+
**kwargs
427+
Additional keyword arguments set `matplotlib.patches.PathPatch`
428+
properties, listed below. For example, one may want to use
429+
``fill=False`` or ``label='A legend entry'``.
412430
413431
%(Patch)s
414432
415-
As examples, ``fill=False`` and ``label='A legend entry'``.
416-
By default, ``facecolor='#bfd1d4'`` (light blue) and
417-
``linewidth=0.5``.
418-
419-
The indexing parameters (*prior* and *connect*) are zero-based.
420-
421-
The flows are placed along the top of the diagram from the inside out
422-
in order of their index within the *flows* list or array. They are
423-
placed along the sides of the diagram from the top down and along the
424-
bottom from the outside in.
425-
426-
If the sum of the inputs and outputs is nonzero, the discrepancy
427-
will appear as a cubic Bezier curve along the top and bottom edges of
428-
the trunk.
429-
430-
.. seealso::
431-
432-
:meth:`finish`
433+
See Also
434+
--------
435+
Sankey.finish
433436
"""
434437
# Check and preprocess the arguments.
435438
if flows is None:

0 commit comments

Comments
 (0)