<divid="unreleased-message"> You are reading an old version of the documentation (v2.2.3). For the latest version see <ahref="/stable/">https://matplotlib.org/stable/</a></div>
<pclass="last">Click <aclass="reference internal" href="#sphx-glr-download-gallery-api-sankey-links-py"><spanclass="std std-ref">here</span></a> to download the full example code</p>
<spanid="sphx-glr-gallery-api-sankey-links-py"></span><h1>Long chain of connections using Sankey<aclass="headerlink" href="#long-chain-of-connections-using-sankey" title="Permalink to this headline">¶</a></h1>
<p>Demonstrate/test the Sankey class by producing a long chain of connections.</p>
<spanclass="kn">from</span><spanclass="nn">matplotlib.sankey</span><spanclass="kn">import</span><ahref="../../api/sankey_api.html#matplotlib.sankey.Sankey" title="View documentation for matplotlib.sankey.Sankey"><spanclass="n">Sankey</span></a>
<spanclass="n">fig</span><spanclass="o">=</span><ahref="../../api/_as_gen/matplotlib.pyplot.figure.html#matplotlib.pyplot.figure" title="View documentation for matplotlib.pyplot.figure"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">figure</span></a><spanclass="p">()</span>
<spanclass="n">title</span><spanclass="o">=</span><spanclass="s2">"Why would you want to do this?</span><spanclass="se">\n</span><spanclass="s2">(But you could.)"</span><spanclass="p">)</span>
<spanclass="n">sankey</span><spanclass="o">=</span><ahref="../../api/sankey_api.html#matplotlib.sankey.Sankey" title="View documentation for matplotlib.sankey.Sankey"><spanclass="n">Sankey</span></a><spanclass="p">(</span><spanclass="n">ax</span><spanclass="o">=</span><spanclass="n">ax</span><spanclass="p">,</span><spanclass="n">unit</span><spanclass="o">=</span><spanclass="bp">None</span><spanclass="p">)</span>
<spanclass="c1"># 1. The alignment doesn't drift significantly (if at all; with 16007</span>
<spanclass="c1"># subdiagrams there is still closure).</span>
<spanclass="c1"># 2. The first diagram is rotated 45 deg, so all other diagrams are rotated</span>
<spanclass="c1"># accordingly.</span>
<ahref="../../api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show" title="View documentation for matplotlib.pyplot.show"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">show</span></a><spanclass="p">()</span>
</pre></div>
</div>
<divclass="sphx-glr-footer class sphx-glr-footer-example docutils container" id="sphx-glr-download-gallery-api-sankey-links-py">