Controlling position of subsystems in Sankey-diagram with matplotlib

自闭症网瘾萝莉.ら 提交于 2019-12-11 09:02:56

问题


I have the following question:

I would like to add two subfigures to a Sankey diagram, that are not connected to each other.

if I draw:

import matplotlib.pyplot as plt
from matplotlib.sankey import Sankey

fig = plt.figure(figsize = (12, 5), frameon=True)
ax = fig.add_subplot(1, 1, 1)

sankey = Sankey(ax=ax, unit=None, radius=0.15, shoulder = 0, gap = 0.15)
sankey.add(flows=[0.2, -0.2], label='A', orientations=[-1, 0])
sankey.add(flows=[0.1, -0.1], label='B', orientations=[1, 0])

diagrams = sankey.finish()
plt.show()

the subfigures are both centered and overlap like this.

I would like to create a figure where these two elemente are next two each other. Is there a way to control the exact position of the elements? (Note: My original diagram is a lot more complex, so I would need to move the elements to a larger extend than it appears in the example) This is the documentation: https://matplotlib.org/api/sankey_api.html

I assume, one would need to get on the level of patches or artist to achieve this, but I can't pin down where exactly to start looking for a solution. Any ideas or tips appreciated.

来源:https://stackoverflow.com/questions/55422657/controlling-position-of-subsystems-in-sankey-diagram-with-matplotlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!