Skip to content

Instantly share code, notes, and snippets.

@domgiles
Created December 25, 2016 12:18
Show Gist options
  • Save domgiles/b6395711036c809cb22bb8cbbe7b1b07 to your computer and use it in GitHub Desktop.
Save domgiles/b6395711036c809cb22bb8cbbe7b1b07 to your computer and use it in GitHub Desktop.
from matplotlib import style
import pandas as pd
from matplotlib import dates
import matplotlib.pyplot as plt
timings = pd.Series(['2016-12-25 08:10:00', '2016-12-25 08:30:00', '2016-12-25 08:50:00', '2016-12-25 08:58:00',
'2016-12-25 09:08:00', '2016-12-25 09:14:00', '2016-12-25 09:20:00', '2016-12-25 09:26:00',
'2016-12-25 09:35:00', '2016-12-25 09:46:00', '2016-12-25 09:55:00', '2016-12-25 10:05:00',
'2016-12-25 10:15:00', '2016-12-25 10:30:00', '2016-12-25 10:55:00', '2016-12-25 11:10:00',
'2016-12-25 11:30:00', '2016-12-25 11:54:00', '2016-12-25 12:15:00'])
temperature_c = pd.Series([9, 10, 12, 13, 15, 17, 20, 22, 25, 30, 33, 37, 42, 49, 58, 63, 69, 75, 78])
df = pd.DataFrame(data=dict(Time_of_Reading=timings, Turkey_Temperature=temperature_c))
df['Time_of_Reading'] = pd.to_datetime(df['Time_of_Reading'])
df.set_index(df['Time_of_Reading'], inplace=True)
style.use('ggplot')
ax = df.plot()
ax.xaxis.set_major_formatter(dates.DateFormatter('%H:%M'))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment