Dear matplotlib developers,
I am attaching an updated boxplot method for axes.py that I would like
to suggest as a replacement for the present one in 0.90. My code does
not change any of the existing functionality, and simply adds a few
options to the existing code:
* I wanted to be able to draw boxplots entirely in black.
* When plotting several boxes on the same axes, where some boxes are
very small in comparison to others, the box outline and notch can
totally mask the median line information. So I added an option to draw
*no* box if the box is sufficiently small so that the median line is
clear. The inner whisker limits provide the only information about q1
and q3 in this case.
* I personally don't find the adaptive notch size very attractive for
publication-quality plots. I added a feature to keep the notch size
fixed (notch==2). This means that very small boxes will foul up, so if
the fixed notch size is smaller than the box height then the "no box"
option is automatically forced on. Fixed notch size is set using the
* I wanted to include an additional (and optional) line in the box for
the mean average of the data (but not associated with an additional
* I wanted to make the boxes white-fillable in case they are placed
over background lines.
* I wanted to set my own axes limits externally, and prevent ticks on
the plot so that I can label the graphs myself and add additional
The attached PNG graphic exemplifies these suggestions with the new
code for a plot that is appearing in an IEEE journal article (please
ignore the black triangle that has nothing to do with the
boxplotting). All the new features involve optional parameters to the
method signature, defaulting in their absence to the existing
The code for the method includes an updated docstring that reflects
how these features are used. Note that I've also made a few minor
edits to the existing parts of the docstring text for clarity: in
particular, regarding the return value, as the existing statement
apparently was not updated when the method was changed to return a
Please feel to discuss these ideas with me.
new_boxplot_method.py (9.78 KB)