SourceForge logo
SourceForge logo
Menu

[matplotlib-devel] Faceted plotting

From: Chris B. <bea...@ha...> - 2013年08月31日 15:21:45
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

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /