More useful return values for boxplot

Hi,

I just read in another thread that the recommended way to submit
patches is to both post them here and on the Sourceforge tracker.
Here's one that I had only posted on the tracker a while ago but that
still seems to apply cleanly to current cvs. It fixes a bug in my
previous boxplot patch (division by zero if you only plot one box),
and changes the return value of boxplot so that you can modify the
different parts of the plot separately, as suggested in John's
commentary to David Haas's original boxplot patch. Here's an example:

In [1]:boxplot(rand(100,2))
Out[1]:
{'boxes': [<matplotlib.lines.Line2D instance at 0x2deaaa8>,
           <matplotlib.lines.Line2D instance at 0x2deae68>],
'caps': [<matplotlib.lines.Line2D instance at 0x2deaaf8>,
          <matplotlib.lines.Line2D instance at 0x2deab70>,
          <matplotlib.lines.Line2D instance at 0x2dea8f0>,
          <matplotlib.lines.Line2D instance at 0x2def170>],
'fliers': [<matplotlib.lines.Line2D instance at 0x2dead00>,
            <matplotlib.lines.Line2D instance at 0x2deab48>,
            <matplotlib.lines.Line2D instance at 0x2def2b0>,
            <matplotlib.lines.Line2D instance at 0x2def148>],
'medians': [<matplotlib.lines.Line2D instance at 0x2deaa58>,
             <matplotlib.lines.Line2D instance at 0x2def210>],
'whiskers': [<matplotlib.lines.Line2D instance at 0x2dea8a0>,
              <matplotlib.lines.Line2D instance at 0x2dea9b8>,
              <matplotlib.lines.Line2D instance at 0x2deae90>,
              <matplotlib.lines.Line2D instance at 0x2deafd0>]}

In [2]:setp(Out[1]['medians'], 'linewidth', 3)
Out[2]:[None, None]

The patch also changes the boxplot demo to demonstrate this.

boxplot-returnvals.patch (6.19 KB)

···

--
Jouni