plot_windrose should provide a "by" parameter
When feeding plot_windrose with a DataFrame with columns: speed, direction, year_month, passing a parameter like by='year_month' should plot several plots on same figure (subplots).
by = 'year_month' # same as 'month' or 'year'
df[by] = df.index.map(lambda dt: (dt.year, dt.month))
similar to http://pandas.pydata.org/pandas-docs/dev/generated/pandas.DataFrame.hist.html https://github.com/pydata/pandas/blob/39d567ec0fcbcaa75d531657412e61f3f274931a/pandas/tools/plotting.py
So it will help to show if major direction of wind (for example) changed over the time.
An other interesting feature could be to animate plot. see https://github.com/scls19fr/windrose/issues/11
http://nbviewer.ipython.org/github/scls19fr/windrose/blob/master/windrose_sample_poitiers_csv.ipynb
Run unit test using
$ nosetests tests.test_windrose:test_plot_by -s -v
Might be useful to define a shape (number of rows and number of columns)
import math
def shape_from(n):
sqrt_n = math.sqrt(n)
Ncol = math.ceil(sqrt_n)
Nrow = math.ceil(n / Ncol)
return(Nrow, Ncol)
for n in range(1, 20+1):
sh = shape_from(n)
print(n , sh, sh[0]*sh[1], sh[0]*sh[1]-n)
ToDo : several pages (figures)
see also http://matplotlib.org/examples/pylab_examples/multipage_pdf.html
https://github.com/scls19fr/windrose/blob/master/samples/example_pdf_by.py
only scatter plot are supported
