These do look nice, and the implementation is fairly light.
I don't have strong feelings about what the best way to include this is:
* as an example
* as a proper mpl pyplot/axes function that imports scipy internally
and raises if it can't find it
* that requires a kde to be passed in
Of these, the top two are probably preferable since in practice
everyone would just pass in the kde from scipy so why not just save
them the step and try to import it ourselves. While I don't want the
core of mpl to require scipy, I can certainly abide by some functions
requiring it as long as they raise helpful errors. So I'm leaning
towards the 2nd option (we already do something like this -- we
conditionally import Image in imread for example)
If we go that way, we will have the worry about version dependencies
and what we want to require on the buildbots.
As for a patch, the implementation looks good though we need a better
docstring and one that is Sphinx compliant. One thing you will want
to consider is how to support the boxplot and fill between keywords.
Eg, people will want to customize the fills, so you may want something
violin_plot(blah, fillprops=None, boxprops=None):
if fillprops is None:
fillprops = dict(facecolor='yellow', alpha=0.3)
if boxprops is None:
boxprops = dict(notch=1, vert=1)
etc... that way people can sti
In you docstring, you should also point to the fill_betweenx and
boxprops docs using the Sphinx API conventions.
Finally, we will need a pass-through interface in pyplot, most likely
through a boilerplate.py entry, and a unit test
Some of this is discussed at
http://matplotlib.sourceforge.net/devel/coding_guide.html, but some of
these conventions are undocumented, so we're happy to help with any
part that is confusing.
On Thu, Sep 17, 2009 at 11:28 PM, Andrew Straw <strawman@...106...> wrote:
Flávio Coelho has implemented Violin plots for MPL. Nice! He has a
question regarding its suitability for inclusion due to a dependency on
scipy for the gaussian_kde function.
Is there a place this could live in the MPL code base without requiring
scipy? Perhaps we should just include it as a demo. I note that
examples/pylab_examples/demo_agg_filter.py requires scipy, too.
Thanks Flávio for sharing -- I have occasionally wondered how my data
would look in a violin plot.