ec9877607bae4108032e7bf60eb7bd78ea322fb8
[matplotlib-cdsw] / 003-plot-timeseries.py
1 """ 
2 003-plot-timeseries.py 
3
4 Plot data from the Harry Potter data-set as a time-series
5
6 """ 
7
8
9 import matplotlib.pyplot as plt 
10 import load_hp_data as hp
11
12 # We can play with styles:
13 #plt.style.use('bmh')
14 plt.style.use('ggplot') 
15 # To see available styles, type: 
16 #plt.style.available
17
18 fig, ax = plt.subplots(1)
19 ax.plot(hp.columns['timestamp'],  hp.columns['size'])
20 ax.set_xlabel('Time')
21 ax.set_ylabel('Size of the edit')
22
23 plt.show()
24
25
26 # Challenge: plot the relationship between edit size. Use 
27
28 ## Hint 1: 
29
30 #delta_time1 = hp.columns['timestamp'][1] - hp.columns['timestamp'][0]
31
32 ## Hint 2: 
33
34 # You can give `plt.plot` more arguments to control the shape/size/color 
35 # of the markers used. For example, try: 
36
37 # ax.plot([1,2,3], [2,4,8], '.')
38 # ax.plot([1,2,3], [2,4,8], 'r.')

Benjamin Mako Hill || Want to submit a patch?