Code review request: minor modifications to axes.boxplot

Matplotlib gurus:

I took at stab at the git work flow and incorporated my personal
modifications to the boxplot function. Github's diff can be found
here:
https://github.com/phobson/matplotlib/compare/master...manual_boxplots

In summary, if your data is MxN, you can manually specify medians and
the confidence intervals around the medians using Nx1 and Nx2 arrays,
respectively. Alternatively, you can use lists or tuples and use Nones
if you want to specify those values only for some columns in your MxN
data set. In other words, with an Mx5 data array, you can specify
conf_intervals=[(ci1a,ci2a), (ci1b,ci2b), (ci1c,ci2c), None,
(ci1e,ci2e)]. Within the conf_intervals "array", the CIs can be listed
in any order as I use np.max() and np.min() to pull the upper and
lower values, respectively.

The motivation behind this is that sometimes I need the confidence
levels to be different than 95%, and also that I compute those
confidence intervals with a bootstrapping routine that is more robust
than mpl-compatible one I submitted some time ago.

I hope y'all find this to be a useful contribution. I'm an avid
matplotlib user. It really is a wonderful tool.

Cheers,
paul h

Paul,

Interesting. I haven’t had much time to really look over your changes, but I have been wondering if the errorbar() and boxplot() functions could be treated as two different ways to display similar information. Therefore, perhaps their call signatures could be made more similar to each other. What do you think?

Ben Root

···

On Thu, Dec 8, 2011 at 10:45 AM, Paul Hobson <pmhobson@…149…> wrote:

Matplotlib gurus:

I took at stab at the git work flow and incorporated my personal

modifications to the boxplot function. Github’s diff can be found

here:

https://github.com/phobson/matplotlib/compare/master…manual_boxplots

In summary, if your data is MxN, you can manually specify medians and

the confidence intervals around the medians using Nx1 and Nx2 arrays,

respectively. Alternatively, you can use lists or tuples and use Nones

if you want to specify those values only for some columns in your MxN

data set. In other words, with an Mx5 data array, you can specify

conf_intervals=[(ci1a,ci2a), (ci1b,ci2b), (ci1c,ci2c), None,

(ci1e,ci2e)]. Within the conf_intervals “array”, the CIs can be listed

in any order as I use np.max() and np.min() to pull the upper and

lower values, respectively.

The motivation behind this is that sometimes I need the confidence

levels to be different than 95%, and also that I compute those

confidence intervals with a bootstrapping routine that is more robust

than mpl-compatible one I submitted some time ago.

I hope y’all find this to be a useful contribution. I’m an avid

matplotlib user. It really is a wonderful tool.

Cheers,

paul h

Ben,

Thanks for the reply. I definitely like your idea. Seems like we could
include some logic in axes.errorbar to look at the shapes of xerr and
yerr in a similar fashion to what I propose for axes.boxplots,
allowing the user to have custom lower and upper errors for each data
point (in a time series as I would use it).

I'll try to bang that out this weekend while this is still fresh.
-p

···

On Fri, Dec 9, 2011 at 1:29 PM, Benjamin Root <ben.root@...553...> wrote:

On Thu, Dec 8, 2011 at 10:45 AM, Paul Hobson <pmhobson@...149...> wrote:

Matplotlib gurus:

I took at stab at the git work flow and incorporated my personal
modifications to the boxplot function. Github's diff can be found
here:
https://github.com/phobson/matplotlib/compare/master...manual_boxplots

In summary, if your data is MxN, you can manually specify medians and
the confidence intervals around the medians using Nx1 and Nx2 arrays,
respectively. Alternatively, you can use lists or tuples and use Nones
if you want to specify those values only for some columns in your MxN
data set. In other words, with an Mx5 data array, you can specify
conf_intervals=[(ci1a,ci2a), (ci1b,ci2b), (ci1c,ci2c), None,
(ci1e,ci2e)]. Within the conf_intervals "array", the CIs can be listed
in any order as I use np.max() and np.min() to pull the upper and
lower values, respectively.

The motivation behind this is that sometimes I need the confidence
levels to be different than 95%, and also that I compute those
confidence intervals with a bootstrapping routine that is more robust
than mpl-compatible one I submitted some time ago.

I hope y'all find this to be a useful contribution. I'm an avid
matplotlib user. It really is a wonderful tool.

Cheers,
paul h

Paul,

Interesting. I haven't had much time to really look over your changes, but
I have been wondering if the errorbar() and boxplot() functions could be
treated as two different ways to display similar information. Therefore,
perhaps their call signatures could be made more similar to each other.
What do you think?

Ben Root