merged in all the code from ariel's branches and moved wikibios to a subdir
[matplotlib-cdsw] / wikibios / scatterplot.py
diff --git a/wikibios/scatterplot.py b/wikibios/scatterplot.py
new file mode 100644 (file)
index 0000000..61582d8
--- /dev/null
@@ -0,0 +1,21 @@
+"""Make a scatterplot of male and female articles."""
+import wikibios
+from datetime import datetime
+from matplotlib import pyplot
+
+figure = pyplot.figure()
+axes = figure.gca()
+
+firstedits_male = wikibios.columns_male['firstedit']
+birth_years_male = wikibios.columns_male['birth_year']
+axes.scatter(firstedits_male, birth_years_male, alpha=0.1, c='green', edgecolors='None', label='Male')
+
+firstedits_female = wikibios.columns_female['firstedit']
+birth_years_female = wikibios.columns_female['birth_year']
+axes.scatter(firstedits_female, birth_years_female, alpha=0.1, c='orange', edgecolors='None', label='Female')
+axes.set_xlabel('Article Date')
+axes.set_ylabel('Birth Year')
+axes.legend()
+
+figure.savefig('scatter.png')
+

Benjamin Mako Hill || Want to submit a patch?