merged in all the code from ariel's branches and moved wikibios to a subdir
[matplotlib-cdsw] / wikibios / logscatterplot.py
1 """Make a scatterplot of male and female articles with logarithmic birth year axis scaling."""
2 import wikibios
3 from matplotlib import pyplot
4
5 figure = pyplot.figure()
6 axes = figure.gca()
7
8 firstedits_male = wikibios.columns_male['firstedit']
9 years_ago_male = [2015 - y for y in wikibios.columns_male['birth_year']]
10 firstedits_female = wikibios.columns_female['firstedit']
11 years_ago_female = [2015 - y for y in wikibios.columns_female['birth_year']]
12
13 axes.scatter(firstedits_male, years_ago_male, alpha=0.1, c='green', edgecolors='None', label='Male')
14 axes.scatter(firstedits_female, years_ago_female, alpha=0.1, c='orange', edgecolors='None', label='Female')
15 axes.set_xlabel('Article Date')
16 axes.set_ylabel('Years Ago')
17 axes.set_yscale('log')
18 axes.legend()
19 figure.savefig('logscatter.png')

Benjamin Mako Hill || Want to submit a patch?