Skip to content

Instantly share code, notes, and snippets.

@dhhagan
Created August 15, 2015 04:34
Show Gist options
  • Select an option

  • Save dhhagan/38ec70cef573881b3f2a to your computer and use it in GitHub Desktop.

Select an option

Save dhhagan/38ec70cef573881b3f2a to your computer and use it in GitHub Desktop.
Make pretty x-axis labels for Time series data
fig, ax = plt.subplots(1, 1)
with sns.axes_style('white'):
ax.plot(final.index, final['AFE1_X2-01_degC'], label = 'T RTD-X2-01')
ax.plot(final.index, final['AFE2_X2-01_degC'], label = 'T RTD-X2-01b')
ax.plot(final.index, final['AFE1_X2-02_degC'], label = 'T RTD-X2-02')
ax.plot(final.index, final['AFE2_X2-02_degC'], label = 'T RTD-X2-02b')
ax.set_title("X2-Series RTD Intercomparison")
ax.set_xlabel("Local Time (EST)")
ax.set_ylabel("T degC")
ax.legend(loc = 'best')
ax.xaxis.set_minor_locator(dates.HourLocator(interval = 4))
ax.xaxis.set_minor_formatter(dates.DateFormatter('%H:%M'))
ax.xaxis.set_major_locator(dates.WeekdayLocator(byweekday=(1), interval=1))
ax.xaxis.set_major_formatter(dates.DateFormatter('\n%d-%b\n%Y'))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment