multiple boxplot in the one plot

Noel Faux <noel.faux@...811...> writes:

I'm wanting to boxplot two
distributions with diff number of observations.

I wanted to do something similar, and it seems that the current
boxplot implementation doesn't quite allow it, but it is easy to
modify. I'm attaching a patch that allows you to set the position and
width of each box (as in Matlab's boxplot), so if you set hold(True),
you can call boxplot multiple times with different positions.

It's not perfect: it forces the limits and ticks of the last boxplot
on the axes, so you have to set the limits and ticks manually after
doing all the plots. I tried to fix this problem by extending the
limits and adding to the ticks instead of replacing them if holdStatus
is true, but then I got extra ticks at 0.0, 0.2, ..., 1.0; I guess
these are automatically generated when the figure is initialized, and
I don't know how to tell the difference between a just-initialized
figure and one where the user has set the ticks.

boxplot.patch (3.59 KB)


Jouni K Sepp�nen