我有五个点,我想在一张图中使用matplotlib绘制多个x(t)
,y(t)
和z(t)
坐标。我写了这个python代码:
import matplotlib.pyplot as plt
fig = plt.figure(4)
fig.set_facecolor('white')
yprops = dict(rotation=0,
horizontalalignment='right',
verticalalignment='center')
axprops = dict(yticks=[])
targets = ['centroid_label','centroid_base','centroid_apex','midgland_inferior','midgland_left','midgland_right','midgland_superior']
count = 0.0
axlist = []
for target in targets:
x,y,z = getXYZMotion_with_compensation(case,target)
ax = fig.add_axes([0.1, count, 0.8, 0.2], **axprops)
axlist.append(ax)
axprops['sharex'] = ax
axprops['sharey'] = ax
ax.plot(list_of_times_in_minutes, x)
ax.plot(list_of_times_in_minutes, y)
ax.plot(list_of_times_in_minutes, z)
ax.set_ylabel(target, **yprops)
count = count + 0.2
#turn off x ticklabels for all but the lower axes
for ax in axlist:
plt.setp(ax.get_xticklabels(), visible=False)
plt.show()
产生:
但是,我希望所有轴的x轴描述低于最低图形和y轴描述每个子图形从-3到3.我怎样才能实现这一点?