<divid="unreleased-message"> You are reading an old version of the documentation (v1.4.0). For the latest version see <ahref="https://matplotlib.org/stable/api/sankey_api.html">https://matplotlib.org/stable/api/sankey_api.html</a></div>
If <em>ax</em> isn’t provided, new axes will be created.</td>
</tr>
<trclass="row-odd"><td><em>scale</em></td>
<td>scaling factor for the flows
<em>scale</em> sizes the width of the paths in order to
maintain proper layout. The same scale is applied
to all subdiagrams. The value should be chosen
such that the product of the scale and the sum of
the inputs is approximately 1.0 (and the product of
the scale and the sum of the outputs is
approximately -1.0).</td>
</tr>
<trclass="row-even"><td><em>unit</em></td>
<td>string representing the physical unit associated
with the flow quantities
If <em>unit</em> is None, then none of the quantities are
labeled.</td>
</tr>
<trclass="row-odd"><td><em>format</em></td>
<td>a Python number formatting string to be used in
labeling the flow as a quantity (i.e., a number
times a unit, where the unit is given)</td>
</tr>
<trclass="row-even"><td><em>gap</em></td>
<td>space between paths that break in/break away
to/from the top or bottom</td>
</tr>
<trclass="row-odd"><td><em>radius</em></td>
<td>inner radius of the vertical paths</td>
</tr>
<trclass="row-even"><td><em>shoulder</em></td>
<td>size of the shoulders of output arrowS</td>
</tr>
<trclass="row-odd"><td><em>offset</em></td>
<td>text offset (from the dip or tip of the arrow)</td>
</tr>
<trclass="row-even"><td><em>head_angle</em></td>
<td>angle of the arrow heads (and negative of the angle
of the tails) [deg]</td>
</tr>
<trclass="row-odd"><td><em>margin</em></td>
<td>minimum space between Sankey outlines and the edge
of the plot area</td>
</tr>
<trclass="row-even"><td><em>tolerance</em></td>
<td>acceptable maximum of the magnitude of the sum of
flows
The magnitude of the sum of connected flows cannot
be greater than <em>tolerance</em>.</td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>The optional arguments listed above are applied to all subdiagrams so
that there is consistent alignment and formatting.</p>
<p>If <aclass="reference internal" href="#matplotlib.sankey.Sankey" title="matplotlib.sankey.Sankey"><ttclass="xref py py-class docutils literal"><spanclass="pre">Sankey</span></tt></a> is instantiated with any keyword arguments other
than those explicitly listed above (<ttclass="docutils literal"><spanclass="pre">**kwargs</span></tt>), they will be passed
to <aclass="reference internal" href="#matplotlib.sankey.Sankey.add" title="matplotlib.sankey.Sankey.add"><ttclass="xref py py-meth docutils literal"><spanclass="pre">add()</span></tt></a>, which will create the first subdiagram.</p>
<p>In order to draw a complex Sankey diagram, create an instance of
<aclass="reference internal" href="#matplotlib.sankey.Sankey" title="matplotlib.sankey.Sankey"><ttclass="xref py py-class docutils literal"><spanclass="pre">Sankey</span></tt></a> by calling it without any kwargs:</p>
<ttclass="descname">add</tt><spanclass="sig-paren">(</span><em>patchlabel=u''</em>, <em>flows=None</em>, <em>orientations=None</em>, <em>labels=u''</em>, <em>trunklength=1.0</em>, <em>pathlengths=0.25</em>, <em>prior=None</em>, <em>connect=(0</em>, <em>0)</em>, <em>rotation=0</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.sankey.Sankey.add" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a simple Sankey diagram with flows at the same hierarchical level.</p>
<p>Return value is the instance of <aclass="reference internal" href="#matplotlib.sankey.Sankey" title="matplotlib.sankey.Sankey"><ttclass="xref py py-class docutils literal"><spanclass="pre">Sankey</span></tt></a>.</p>
<p>Optional keyword arguments:</p>
<blockquote>
<div><tableborder="1" class="docutils">
<colgroup>
<colwidth="23%" />
<colwidth="77%" />
</colgroup>
<theadvalign="bottom">
<trclass="row-odd"><thclass="head">Keyword</th>
<thclass="head">Description</th>
</tr>
</thead>
<tbodyvalign="top">
<trclass="row-even"><td><em>patchlabel</em></td>
<td>label to be placed at the center of the diagram
Note: <em>label</em> (not <em>patchlabel</em>) will be passed to
the patch through <ttclass="docutils literal"><spanclass="pre">**kwargs</span></tt> and can be used to
create an entry in the legend.</td>
</tr>
<trclass="row-odd"><td><em>flows</em></td>
<td>array of flow values
By convention, inputs are positive and outputs are
<ttclass="descname">finish</tt><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.sankey.Sankey.finish" title="Permalink to this definition">¶</a></dt>
<dd><p>Adjust the axes and return a list of information about the Sankey
subdiagram(s).</p>
<p>Return value is a list of subdiagrams represented with the following
<td>values of the flows (positive for input, negative
for output)</td>
</tr>
<trclass="row-even"><td><em>angles</em></td>
<td>list of angles of the arrows [deg/90]
For example, if the diagram has not been rotated,
an input to the top side will have an angle of 3
(DOWN), and an output from the top side will have
an angle of 1 (UP). If a flow has been skipped
(because its magnitude is less than <em>tolerance</em>),
then its angle will be <em>None</em>.</td>
</tr>
<trclass="row-odd"><td><em>tips</em></td>
<td>array in which each row is an [x, y] pair
indicating the positions of the tips (or “dips”) of
the flow paths
If the magnitude of a flow is less the <em>tolerance</em>
for the instance of <aclass="reference internal" href="#matplotlib.sankey.Sankey" title="matplotlib.sankey.Sankey"><ttclass="xref py py-class docutils literal"><spanclass="pre">Sankey</span></tt></a>, the flow is
skipped and its tip will be at the center of the
diagram.</td>
</tr>
<trclass="row-even"><td><em>text</em></td>
<td><aclass="reference internal" href="text_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><ttclass="xref py py-class docutils literal"><spanclass="pre">Text</span></tt></a> instance for the