def boxplot(self, x, notch=<NUM_LIT:0>, sym='<STR_LIT>', vert=<NUM_LIT:1>, whis=<NUM_LIT>,<EOL>positions=None, widths=None):
if not self._hold: self.cla()<EOL>holdStatus = self._hold<EOL>whiskers, caps, boxes, medians, fliers = [], [], [], [], []<EOL>if hasattr(x, '<STR_LIT>'):<EOL><INDENT>if len(x.shape) == <NUM_LIT:1>:<EOL><INDENT>if hasattr(x[<NUM_LIT:0>], '<STR_LIT>'):<EOL><INDENT>x = list(x)<EOL><DEDENT>else:<EOL><INDENT>x = [x,]<EOL><DEDENT><DEDENT>elif len(x.shape) == <NUM_LIT:2>:<EOL><INDENT>nr, nc = x.shape<EOL>if nr == <NUM_LIT:1>:<EOL><INDENT>x = [x]<EOL><DEDENT>elif nc == <NUM_LIT:1>:<EOL><INDENT>x = [x.ravel()]<EOL><DEDENT>else:<EOL><INDENT>x = [x[:,i] for i in range(nc)]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>if not hasattr(x[<NUM_LIT:0>], '<STR_LIT>'):<EOL><INDENT>x = [x]<EOL><DEDENT>col = len(x)<EOL>if positions is None:<EOL><INDENT>positions = list(range(<NUM_LIT:1>, col + <NUM_LIT:1>))<EOL><DEDENT>if widths is None:<EOL><INDENT>distance = max(positions) - min(positions)<EOL>widths = min(<NUM_LIT>*max(distance,<NUM_LIT:1.0>), <NUM_LIT:0.5>)<EOL><DEDENT>if isinstance(widths, float) or isinstance(widths, int):<EOL><INDENT>widths = np.ones((col,), float) * widths<EOL><DEDENT>self.hold(True)<EOL>for i,pos in enumerate(positions):<EOL><INDENT>d = np.ravel(x[i])<EOL>row = len(d)<EOL>q1, med, q3 = mlab.prctile(d,[<NUM_LIT>,<NUM_LIT:50>,<NUM_LIT>])<EOL>iq = q3 - q1<EOL>hi_val = q3 + whis*iq<EOL>wisk_hi = np.compress( d <= hi_val , d )<EOL>if len(wisk_hi) == <NUM_LIT:0>:<EOL><INDENT>wisk_hi = q3<EOL><DEDENT>else:<EOL><INDENT>wisk_hi = max(wisk_hi)<EOL><DEDENT>lo_val = q1 - whis*iq<EOL>wisk_lo = np.compress( d >= lo_val, d )<EOL>if len(wisk_lo) == <NUM_LIT:0>:<EOL><INDENT>wisk_lo = q1<EOL><DEDENT>else:<EOL><INDENT>wisk_lo = min(wisk_lo)<EOL><DEDENT>flier_hi = []<EOL>flier_lo = []<EOL>flier_hi_x = []<EOL>flier_lo_x = []<EOL>if len(sym) != <NUM_LIT:0>:<EOL><INDENT>flier_hi = np.compress( d > wisk_hi, d )<EOL>flier_lo = np.compress( d < wisk_lo, d )<EOL>flier_hi_x = np.ones(flier_hi.shape[<NUM_LIT:0>]) * pos<EOL>flier_lo_x = np.ones(flier_lo.shape[<NUM_LIT:0>]) * pos<EOL><DEDENT>box_x_min = pos - widths[i] * <NUM_LIT:0.5><EOL>box_x_max = pos + widths[i] * <NUM_LIT:0.5><EOL>wisk_x = np.ones(<NUM_LIT:2>) * pos<EOL>cap_x_min = pos - widths[i] * <NUM_LIT><EOL>cap_x_max = pos + widths[i] * <NUM_LIT><EOL>cap_x = [cap_x_min, cap_x_max]<EOL>med_y = [med, med]<EOL>if notch == <NUM_LIT:0>:<EOL><INDENT>box_x = [box_x_min, box_x_max, box_x_max, box_x_min, box_x_min ]<EOL>box_y = [q1, q1, q3, q3, q1 ]<EOL>med_x = [box_x_min, box_x_max]<EOL><DEDENT>else:<EOL><INDENT>notch_max = med + <NUM_LIT>*iq/np.sqrt(row)<EOL>notch_min = med - <NUM_LIT>*iq/np.sqrt(row)<EOL>if notch_max > q3:<EOL><INDENT>notch_max = q3<EOL><DEDENT>if notch_min < q1:<EOL><INDENT>notch_min = q1<EOL><DEDENT>box_x = [box_x_min, box_x_max, box_x_max, cap_x_max, box_x_max,<EOL>box_x_max, box_x_min, box_x_min, cap_x_min, box_x_min,<EOL>box_x_min ]<EOL>box_y = [q1, q1, notch_min, med, notch_max, q3, q3, notch_max,<EOL>med, notch_min, q1]<EOL>med_x = [cap_x_min, cap_x_max]<EOL>med_y = [med, med]<EOL><DEDENT>if vert:<EOL><INDENT>def doplot(*args):<EOL><INDENT>return self.plot(*args)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>def doplot(*args):<EOL><INDENT>shuffled = []<EOL>for i in range(<NUM_LIT:0>, len(args), <NUM_LIT:3>):<EOL><INDENT>shuffled.extend([args[i+<NUM_LIT:1>], args[i], args[i+<NUM_LIT:2>]])<EOL><DEDENT>return self.plot(*shuffled)<EOL><DEDENT><DEDENT>whiskers.extend(doplot(wisk_x, [q1, wisk_lo], '<STR_LIT>',<EOL>wisk_x, [q3, wisk_hi], '<STR_LIT>'))<EOL>caps.extend(doplot(cap_x, [wisk_hi, wisk_hi], '<STR_LIT>',<EOL>cap_x, [wisk_lo, wisk_lo], '<STR_LIT>'))<EOL>boxes.extend(doplot(box_x, box_y, '<STR_LIT>'))<EOL>medians.extend(doplot(med_x, med_y, '<STR_LIT>'))<EOL>fliers.extend(doplot(flier_hi_x, flier_hi, sym,<EOL>flier_lo_x, flier_lo, sym))<EOL><DEDENT>if <NUM_LIT:1> == vert:<EOL><INDENT>setticks, setlim = self.set_xticks, self.set_xlim<EOL><DEDENT>else:<EOL><INDENT>setticks, setlim = self.set_yticks, self.set_ylim<EOL><DEDENT>newlimits = min(positions)-<NUM_LIT:0.5>, max(positions)+<NUM_LIT:0.5><EOL>setlim(newlimits)<EOL>setticks(positions)<EOL>self.hold(holdStatus)<EOL>return dict(whiskers=whiskers, caps=caps, boxes=boxes,<EOL>medians=medians, fliers=fliers)<EOL>
call signature::

  boxplot(x, notch=0, sym='+', vert=1, whis=1.5,
          positions=None, widths=None)

Make a box and whisker plot for each column of *x* or each
vector in sequence *x*.  The box extends from the lower to
upper quartile values of the data, with a line at the median.
The whiskers extend from the box to show the range of the
data.  Flier points are those past the end of the whiskers.

- *notch* = 0 (default) produces a rectangular box plot.
- *notch* = 1 will produce a notched box plot

*sym* (default 'b+') is the default symbol for flier points.
Enter an empty string ('') if you don't want to show fliers.

- *vert* = 1 (default) makes the boxes vertical.
- *vert* = 0 makes horizontal boxes.  This seems goofy, but
  that's how Matlab did it.

*whis* (default 1.5) defines the length of the whiskers as
a function of the inner quartile range.  They extend to the
most extreme data point within ( ``whis*(75%-25%)`` ) data range.

*positions* (default 1,2,...,n) sets the horizontal positions of
the boxes. The ticks and limits are automatically set to match
the positions.

*widths* is either a scalar or a vector and sets the width of
each box. The default is 0.5, or ``0.15*(distance between extreme
positions)`` if that is smaller.

*x* is an array or a sequence of vectors.

Returns a dictionary mapping each component of the boxplot
to a list of the :class:`matplotlib.lines.Line2D`
instances created.

**Example:**

.. plot:: pyplots/boxplot_demo.py