Reddit readers visualised using Python
We collected the number of readers from http://www.reddit.com/r/dataisbeautiful/ from 2012 to 2014 using the Wayback Machine. We used Python and Matplotlib to produce this chart:
Readers of /r/dataisbeautiful
The Python script we made below generates this graph. It puts the y-axis into a nice comma format. In addition, it adds the time series.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
from pylab import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import datetime as dt
def comma_format(x, p):
return format(x, "6,.0f").replace(",", ".")
ax = subplot(111)
data = [448,448,9533, 12258, 15440, 17484, 21450,24045, 26198, 31903, 37271,45808, 49765,68182, 75964,82828 ,89805, 102488,109054 , 116028, 124239, 129882, 136492,151742, 160985 ,169541,181385,388633, 615584,796437,1233638,1463458,1716989,1950048]
x = mpl.dates.drange(dt.datetime(2012,3,1),
dt.datetime(2014,12,12),
dt.timedelta(days=30))
print len(x)
print len(data)
xx = np.arange(0,20,1)
yy = np.arange(1000,10000,450)
plt.title('/r/dataisbeautiful readers')
ylabel('Readers')
xlabel('Date')
ax.get_yaxis().set_major_formatter(ticker.FuncFormatter(comma_format))
#plt.plot(data, label='Readers')
plt.plot_date(x, data, '-', label='Readers')
plt.show()
|
Raw data:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
Date Readers
01/02/2012 448
02/04/2012 448
07/05/2012 9,533
02/06/2012 12,258
08/07/2012 15,440
04/08/2012 17,484
10/09/2012 21,450
11/10/2012 24,045
01/11/2012 26,198
03/12/2012 31,903
02/01/2013 37,271
04/02/2013 45,808
02/03/2013 49,765
02/04/2013 68,182
01/05/2013 75,964
01/06/2013 82,828
01/07/2013 89,805
01/08/2013 102,488
01/09/2013 109,054
01/10/2013 116,028
01/11/2013 124,239
02/12/2013 129,882
01/01/2014 136,492
01/02/2014 151,742
02/03/2014 160,985
06/04/2014 169,541
04/05/2014 181,385
01/06/2014 388,633
06/07/2014 615,584
01/08/2014 796,437
28/09/2014 1,233,638
28/10/2014 1,463,458
28/11/2014 1,716,989
30/12/2014 1,950,048
|