Pandas has some nice tools to make faceted plots -- small multiples of
plots where data is grouped by category (
http://pandas.pydata.org/pandas-docs/stable/rplot.html). However, I think
there would be value in having this functionality built into matplotlib.
Mainly:
1. Not every dataset lives in a dataframe
2. The pandas library mimics the ggplot interface, and some people would
prefer an interface closer to matplotlib
3. Properly implemented, I think a matplotlib facet system would enable a
wider variety of faceted plots than the pandas tools.
I've taken a stab at this, and came up with an interface that I think has
potential. This currently exists as a separate repository at
https://github.com/ChrisBeaumont/mplfacet, and an example notebook at
http://bit.ly/17u1JzP
There two basic ways to use a facet object:
Facet(key, data).method()
will group one or more data arrays by key, and build a subplot for each
group by calling method (which is any axes plot method). Alternatively,
for item in Facet(key, data):
x, y = item.data
item.axes.scatter(x, y)
sets up the subplots and groups the data for you, but gives you more
freedom to populate each subplot however you like.
Is there interest in building this into matplotlib? If so, I would like to
polish it up and submit a PR.
Cheers,
Chris
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel