I would like to remove seconds from my x-axis labels as they are unnecessary.
Also I want to center align the tick labels instead of have them positioned to the left of the tick mark.
Any suggestions on how to do this?
Here is some of the code that I've used if this helps
fig=plt.figure()
ax=fig.add_subplot(111)
line1 = plot(table.index,table[data],color=colors[0])
fig.autofmt_xdate(rotation=0)
tickFormat = matplotlib.ticker.LinearLocator(numticks=5)
ax.xaxis.set_major_locator(tickFormat)
from matplotlib.dates import DateFormatter
formatter = DateFormatter('%H:%M')
plt.gcf().axes[0].xaxis.set_major_formatter(formatter)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With