我必须在我的图表中绘制3个不同通道的脑电图数据。我想把它们都画在一个用水平线隔开的图形里。所有通道共用的X轴。在
我可以通过使用add_轴轻松完成此操作。但我想画一条垂直线,和这些轴相交。但我做不到。在
目前,我的示例代码如下所示。在
from pylab import figure, show, setp
from numpy import sin, cos, exp, pi, arange
t = arange(0.0, 2.0, 0.01)
s1 = sin(2*pi*t)
s2 = exp(-t)
s3 = 200*t
fig = figure()
t = arange(0.0, 2.0, 0.01)
yprops = dict(rotation=0,
horizontalalignment='right',
verticalalignment='center',
x=-0.1)
axprops = dict(yticks=[])
ax1 =fig.add_axes([0.1, 0.5, 0.8, 0.2], **axprops)
ax1.plot(t, s1)
ax1.set_ylabel('S1', **yprops)
axprops['sharex'] = ax1
#axprops['sharey'] = ax1
# force x axes to remain in register, even with toolbar navigation
ax2 = fig.add_axes([0.1, 0.3, 0.8, 0.2], **axprops)
ax2.plot(t, s2)
ax2.set_ylabel('S2', **yprops)
ax3 = fig.add_axes([0.1, 0.1, 0.8, 0.2], **axprops)
ax3.plot(t, s3)
ax3.set_ylabel('S3', **yprops)
# turn off x ticklabels for all but the lower axes
for ax in ax1, ax2:
setp(ax.get_xticklabels(), visible=False)
show()
我希望我的最终图像看起来像下面的那个。在我当前的输出中,我可以得到相同的图形,而没有绿色的垂直线。在
有谁能帮忙吗???我不想使用子批次,也不想为每个轴添加轴。在
谢谢你, 托塔德里
使用
要为每个帧更新:
^{pr2}$^{} doc
相关问题 更多 >
编程相关推荐