Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_windrose should provide a "by" parameter #10

Open
s-celles opened this issue Jun 19, 2015 · 3 comments
Open

plot_windrose should provide a "by" parameter #10

s-celles opened this issue Jun 19, 2015 · 3 comments

Comments

@s-celles
Copy link
Member

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
@s-celles
Copy link
Member Author

s-celles commented Jul 7, 2015

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)

@s-celles
Copy link
Member Author

s-celles commented Jul 7, 2015

ToDo : several pages (figures)

see also
http://matplotlib.org/examples/pylab_examples/multipage_pdf.html

@s-celles
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant