8000 numpydocify Sankey.add. · matplotlib/matplotlib@02900f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 02900f4

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 02900f4

File tree

1 file changed

+77
-74
lines changed

1 file changed

+77
-74
lines changed

lib/matplotlib/sankey.py

Lines changed: 77 additions & 74 deletions
< 57AE td data-grid-cell-id="diff-6bd0a97ffa4949672c064525b4d02aeac4a4d1ff845e68ddbf06598d78200c93-411-390-2" data-line-anchor="diff-6bd0a97ffa4949672c064525b4d02aeac4a4d1ff845e68ddbf06598d78200c93R390" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionLine-bgColor, var(--diffBlob-addition-bgColor-line));padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell right-side-diff-cell left-side">+
shown, regardless of the value of this argument.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Module for creating Sankey diagrams using matplotlib
2+
Module for creating Sankey diagrams using Matplotlib.
33
"""
44

55
import logging
@@ -29,7 +29,7 @@
2929

3030
class Sankey(object):
3131
"""
32-
Sankey diagram in matplotlib
32+
Sankey diagram.
3333
3434
Sankey diagrams are a specific type of flow diagram, in which
3535
the width of the arrows is shown proportionally to the flow
@@ -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*) can be passed as keyword
363+
argument to create an entry in the legend.
364+
365+
flows : list of float
366+
Array of flow values. By convention, inputs are positive and
367+
outputs are negative.
368+
369+
Flows are placed along the top of the diagram from the inside out
370+
in order of their index within *flows*. They are placed along the
371+
sides of the diagram from the top down and along the bottom from
372+
the outside in.
373+
374+
If the sum of the inputs and outputs is
375+
nonzero, the discrepancy will appear as a cubic Bezier curve along
376+
the top and bottom edges of the trunk.
377+
378+
orientations : list of {-1, 0, 1}
379+
List of orientations of the flows (or a single orientation to be
380+
used for all flows). Valid values are 0 (inputs from
381+
the left, outputs to the right), 1 (from and to the top) or -1
382+
(from and to the bottom).
383+
384+
labels : list of (str or None)
385+
List of labels for the flows (or a single label to be used for all
386+
flows). Each label may be *None* (no label), or a labeling string.
387+
If an entry is a (possibly empty) string, then the quantity for the
388+
corresponding flow will be shown below the string. However, if
389+
the *unit* of the main diagram is None, then quantities are never
390
391+
392+
trunklength : float
393+
Length between the bases of the input and output groups (in
394+
data-space units).
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* A1F2 ) 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)
0