]> projects.mako.cc - matplotlib-cdsw/blob - scatterplot.py
Use consistent API.
[matplotlib-cdsw] / scatterplot.py
1 """Make a scatterplot of male and female articles."""
2 import wikibios
3 from datetime import datetime
4 from matplotlib import pyplot
5
6 figure = pyplot.figure()
7 axes = figure.gca()
8
9 firstedits_male = wikibios.columns_male['firstedit']
10 birth_years_male = wikibios.columns_male['birth_year']
11 axes.scatter(firstedits_male, birth_years_male, alpha=0.1, c='green', edgecolors='None', label='Male')
12
13 firstedits_female = wikibios.columns_female['firstedit']
14 birth_years_female = wikibios.columns_female['birth_year']
15 axes.scatter(firstedits_female, birth_years_female, alpha=0.1, c='orange', edgecolors='None', label='Female')
16 axes.set_xlabel('Article Date')
17 axes.set_ylabel('Birth Year')
18 axes.legend()
19
20 figure.savefig('scatter.png')
21

Benjamin Mako Hill || Want to submit a patch?