Code: Select all
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
from matplotlib import pyplot
from matplotlib import dates
fig = pyplot.figure()
ax = fig.add_subplot(111)
ax.xaxis.set_major_locator(dates.HourLocator(interval=6))
ax.xaxis.set_major_formatter(hfmt)
pylab.xticks(rotation='vertical')
pyplot.subplots_adjust(bottom=.3)
pylab.plot(t, s, color='b',label="Inside Temp (C) ",linestyle="-",marker=".")
pylab.plot(t, v, color='g',label="Outside Temp (C)",linestyle="-",marker=".")
pylab.xlabel("Hours")
pylab.ylabel("degrees C")
pylab.legend(loc='upper left')
pylab.axis([min(t), max(t), 0, 50])
ax2 = pylab.twinx()
pylab.ylabel("% ")
pylab.plot(t, x, color='y',label="Outside Hum %",linestyle="-",marker=".")
pylab.plot(t, u, color='r',label="Inside Hum %",linestyle="-",marker=".")
pylab.axis([min(t), max(t), 0, 100])
pylab.legend(loc='lower left')
pylab.figtext(.5, .05, ("Environmental Statistics Last %i Days" % days),fontsize=18,ha='center')
#pylab.grid(True)
pyplot.setp( ax.xaxis.get_majorticklabels(), rotation=70)
ax.xaxis.set_major_formatter(dates.DateFormatter('%m/%d-%H'))
pyplot.show()When I execute this program python example.py, nothing shown up. I am expecting a graph to pop up.
what's wrong?