我有一组不同的时间序列,可以分组。E、 g.下图显示A、B、C和D系列。但是,A和B属于G1组,C和D属于G2组。在
我想在图中反映这一点,在左侧添加另一个轴,该轴穿过多组涡轮机,并相应地标记这些轴。在
到目前为止,我已经试过几件事了,但显然那不是那么容易的事。在
有人知道我怎么做吗?在
PS:因为我在已经有列的数据帧上使用panda的plot(subplots=True)
| G1 | G2 |
|-------|------|
index | A B | C D |
------|-------|------|
也许熊猫已经可以为我做到这一点。这就是我使用pandas标记的原因。在
这是我想出的一个例子。因为你没有提供你的代码,我没有熊猫,因为我不熟练。在
基本上,您可以像这样绘图,然后围绕之前的所有轴创建另一个轴,用
ax5.axis('off')
删除它的轴,然后在上面绘制两行和文本。在灵感来自How to draw a line outside of an axis in matplotlib (in figure coordinates)?
可以在绘图中创建其他轴,这些轴跨越两个绘图,但只有一个左y轴,没有记号和其他装饰。只设置了一个ylabel。这会使整个事情看起来很协调。在
好在你可以利用你现有的熊猫基地。缺点是超过15行代码。在
相关问题 更多 >
编程相关推荐