Skip to content

plot_windrose should provide a "by" parameter #10

Open

Description

@s-celles

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 #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

Activity

  1. s-celles commented on Jul 7, 2015

    @s-celles
    MemberAuthor

    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)
    
  2. s-celles commented on Jul 7, 2015

    @s-celles
    MemberAuthor
  3. s-celles commented on Aug 27, 2015

    @s-celles
    MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions