def setAxisScaleX(self, x_axis_bins):
"""The setAxisScaleX() method sets the bins for the X axis. Presently,
we assume a date-based axis."""
if self.verboseLogging:
self.logger.threaddebug(u"Constructing the bins for the X axis.")
if x_axis_bins == 'quarter-hourly':
plt.gca().xaxis.set_major_locator(mdate.HourLocator(interval=4))
plt.gca().xaxis.set_minor_locator(mdate.HourLocator(byhour=range(0, 24, 96)))
if x_axis_bins == 'half-hourly':
plt.gca().xaxis.set_major_locator(mdate.HourLocator(interval=4))
plt.gca().xaxis.set_minor_locator(mdate.HourLocator(byhour=range(0, 24, 48)))
elif x_axis_bins == 'hourly':
plt.gca().xaxis.set_major_locator(mdate.HourLocator(interval=4))
plt.gca().xaxis.set_minor_locator(mdate.HourLocator(byhour=range(0, 24, 24)))
elif x_axis_bins == 'hourly_4':
plt.gca().xaxis.set_major_locator(mdate.HourLocator(interval=4))
plt.gca().xaxis.set_minor_locator(mdate.HourLocator(byhour=range(0, 24, 8)))
elif x_axis_bins == 'hourly_8':
plt.gca().xaxis.set_major_locator(mdate.HourLocator(interval=4))
plt.gca().xaxis.set_minor_locator(mdate.HourLocator(byhour=range(0, 24, 4)))
elif x_axis_bins == 'hourly_12':
plt.gca().xaxis.set_major_locator(mdate.HourLocator(interval=4))
plt.gca().xaxis.set_minor_locator(mdate.HourLocator(byhour=range(0, 24, 2)))
elif x_axis_bins == 'daily':
plt.gca().xaxis.set_major_locator(mdate.DayLocator(interval=1))
plt.gca().xaxis.set_minor_locator(mdate.HourLocator(byhour=range(0, 24, 6)))
elif x_axis_bins == 'weekly':
plt.gca().xaxis.set_major_locator(mdate.DayLocator(interval=7))
plt.gca().xaxis.set_minor_locator(mdate.DayLocator(interval=1))
elif x_axis_bins == 'monthly':
plt.gca().xaxis.set_major_locator(mdate.MonthLocator(interval=1))
plt.gca().xaxis.set_minor_locator(mdate.DayLocator(interval=1))
elif x_axis_bins == 'yearly':
plt.gca().xaxis.set_major_locator(mdate.YearLocator())
plt.gca().xaxis.set_minor_locator(mdate.MonthLocator(interval=12))
评论列表
文章目录