【发布时间】:2011-07-06 18:07:19
【问题描述】:
希望在绘制的图形之间添加垂直空间以允许显示 X 轴标签:
每个图表都需要有空间来显示当天,目前仅最后 2 个图表显示,因为这些图表与其重叠。
我也很好奇我是否真的可以删除标记为星期四/星期五的图形上方的 X 轴的缺口标签,即底部 X 轴是唯一显示的图形。 Y 轴也一样,但只有左侧的图表显示了比例。
*很遗憾,我无法发布图片来展示这一点,因为我没有足够的代表。
代码 sn-p:
import mathlib.pyplot as pyplot
fig = pyplot.figure()
ax1 = fig.add_subplot(4,2,1)
ax1.set_yscale('log')
ax2 = fig.add_subplot(4,2,2, sharex=ax1, sharey=ax1)
ax3 = fig.add_subplot(4,2,3, sharex=ax2, sharey=ax2)
ax4 = fig.add_subplot(4,2,4, sharex=ax3, sharey=ax3)
ax5 = fig.add_subplot(4,2,5, sharex=ax4, sharey=ax4)
ax6 = fig.add_subplot(4,2,6, sharex=ax5, sharey=ax5)
ax7 = fig.add_subplot(4,2,7, sharex=ax6, sharey=ax6)
ax1.plot(no_dict["Saturday"],'k.-',label='Saturday')
ax1.set_xlabel('Saturday')
ax1.axis([0,24,0,10000])
pyplot.suptitle('Title')
pyplot.xlabel('Hour in 24 Hour Format')
ax2.plot(no_dict["Sunday"],'b.-',label='Sunday')
ax2.set_xlabel('Sunday')
...
【问题讨论】:
-
请尝试发布可运行代码。让一个人(你)清理代码可以节省时间,而不是让每个试图回答的人都这样做。即
import mathlib和一些示例数据,而不是指向不存在的字典的链接。 -
啊,好点子,我发这个帖子的时候正在午休,否则我会在你回答之前让它真正可以运行。
标签: python matplotlib