我想用python绘制一个悬挂的根程序。我知道这里已经有一个问题了:How to plot a hanging rootogram in python? 但我的方法有点不同。在
在我的pandas dataframe中,数据是这样组织的:
x:是x轴的点,这里是1、2、3,。。。在
高度:是条的高度
y:绘图起点
线:每个条的边界线
我想要的是每个点的条形图,从y开始,高度。然后,该条的末尾位于行
到目前为止我得到的是:
fig, ax = plt.subplots()
rects = ax.bar(df['x'], df['height'] - df['y'], 1)
ax.plot(df['x'], df['line'], color='r')
ax.set_ylim([-10,15])
我想要的是这样的东西:
这种情况下的解决方法比关联问题简单得多。您只需要使用
bottom
的bottom
参数。在{a1}
相关问题 更多 >
编程相关推荐