Setting boxplot confidence intervals manually

Hey folks,

I'm working on a patch to axes.boxplot that will allow the user to
manually specify the median and confidence intervals (notches) on a
boxplot. My need for this arises since I compute the notch locations
using the BCa-method, which depends on Scipy.

My question relates to how to best have users input their predefined
median and its confidence interval. In my use case, I'm always calling
boxplot one data set at a time and so it has made sense for me pass
the values as a dictionary to my locally-modified boxplot function.
This is probably a quite unique use case.

In the more general use case where an arbitrary number of boxplots
will be generated on a single axes object, what would be the best
method of input? My initial though is to specify a list-of-tuples in
the form: [(lower1, median1, upper1), (lower2, median2, upper2), ...,
(lowerN, medianN, upperN)]. The modified function signature would be:
    def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
                positions=None, widths=None, patch_artist=False,
                bootstrap=None, manualVals=None):

The other best option that comes to mind would be to pass each value
as an individual numpy array with dimensions that are compatible with
the data (x), i.e.,
    def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
                positions=None, widths=None, patch_artist=False,
                bootstrap=None, lowerCIs=None, medians=None, upperCIs=None):

This seems a bit cumbersome both to use and implement, though quite
flexible as the user would not be forced to supply all three arrays.

Any advice, requests, or general input would be much appreciated.

Cheers,
-Paul H.

Just a thought to throw out there… maybe the call signatures/functionalities of boxplot() and errorbar() should get merged? To me, I imagine these kinds of plots as being two sides of the same coin.

Cheers!
Ben Root

···

On Fri, Oct 7, 2011 at 3:40 PM, Paul Hobson <pmhobson@…287…> wrote:

Hey folks,

I’m working on a patch to axes.boxplot that will allow the user to

manually specify the median and confidence intervals (notches) on a

boxplot. My need for this arises since I compute the notch locations

using the BCa-method, which depends on Scipy.

My question relates to how to best have users input their predefined

median and its confidence interval. In my use case, I’m always calling

boxplot one data set at a time and so it has made sense for me pass

the values as a dictionary to my locally-modified boxplot function.

This is probably a quite unique use case.

In the more general use case where an arbitrary number of boxplots

will be generated on a single axes object, what would be the best

method of input? My initial though is to specify a list-of-tuples in

the form: [(lower1, median1, upper1), (lower2, median2, upper2), …,

(lowerN, medianN, upperN)]. The modified function signature would be:

def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,

            positions=None, widths=None, patch_artist=False,

            bootstrap=None, manualVals=None):

The other best option that comes to mind would be to pass each value

as an individual numpy array with dimensions that are compatible with

the data (x), i.e.,

def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,

            positions=None, widths=None, patch_artist=False,

            bootstrap=None, lowerCIs=None, medians=None, upperCIs=None):

This seems a bit cumbersome both to use and implement, though quite

flexible as the user would not be forced to supply all three arrays.

Any advice, requests, or general input would be much appreciated.

Cheers,

-Paul H.