def pie(self, x, explode=None, labels=None, colors=None,<EOL>autopct=None, pctdistance=<NUM_LIT>, shadow=False,<EOL>labeldistance=<NUM_LIT>):
self.set_frame_on(False)<EOL>x = np.asarray(x).astype(np.float32)<EOL>sx = float(x.sum())<EOL>if sx><NUM_LIT:1>: x = np.divide(x,sx)<EOL>if labels is None: labels = ['<STR_LIT>']*len(x)<EOL>if explode is None: explode = [<NUM_LIT:0>]*len(x)<EOL>assert(len(x)==len(labels))<EOL>assert(len(x)==len(explode))<EOL>if colors is None: colors = ('<STR_LIT:b>', '<STR_LIT:g>', '<STR_LIT:r>', '<STR_LIT:c>', '<STR_LIT:m>', '<STR_LIT:y>', '<STR_LIT:k>', '<STR_LIT:w>')<EOL>center = <NUM_LIT:0>,<NUM_LIT:0><EOL>radius = <NUM_LIT:1><EOL>theta1 = <NUM_LIT:0><EOL>i = <NUM_LIT:0><EOL>texts = []<EOL>slices = []<EOL>autotexts = []<EOL>for frac, label, expl in cbook.safezip(x,labels, explode):<EOL><INDENT>x, y = center<EOL>theta2 = theta1 + frac<EOL>thetam = <NUM_LIT:2>*math.pi*<NUM_LIT:0.5>*(theta1+theta2)<EOL>x += expl*math.cos(thetam)<EOL>y += expl*math.sin(thetam)<EOL>w = mpatches.Wedge((x,y), radius, <NUM_LIT>*theta1, <NUM_LIT>*theta2,<EOL>facecolor=colors[i%len(colors)])<EOL>slices.append(w)<EOL>self.add_patch(w)<EOL>w.set_label(label)<EOL>if shadow:<EOL><INDENT>shad = mpatches.Shadow(w, -<NUM_LIT>, -<NUM_LIT>,<EOL>)<EOL>shad.set_zorder(<NUM_LIT>*w.get_zorder())<EOL>self.add_patch(shad)<EOL><DEDENT>xt = x + labeldistance*radius*math.cos(thetam)<EOL>yt = y + labeldistance*radius*math.sin(thetam)<EOL>label_alignment = xt > <NUM_LIT:0> and '<STR_LIT:left>' or '<STR_LIT:right>'<EOL>t = self.text(xt, yt, label,<EOL>size=rcParams['<STR_LIT>'],<EOL>horizontalalignment=label_alignment,<EOL>verticalalignment='<STR_LIT>')<EOL>texts.append(t)<EOL>if autopct is not None:<EOL><INDENT>xt = x + pctdistance*radius*math.cos(thetam)<EOL>yt = y + pctdistance*radius*math.sin(thetam)<EOL>if is_string_like(autopct):<EOL><INDENT>s = autopct%(<NUM_LIT>*frac)<EOL><DEDENT>elif callable(autopct):<EOL><INDENT>s = autopct(<NUM_LIT>*frac)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>')<EOL><DEDENT>t = self.text(xt, yt, s,<EOL>horizontalalignment='<STR_LIT>',<EOL>verticalalignment='<STR_LIT>')<EOL>autotexts.append(t)<EOL><DEDENT>theta1 = theta2<EOL>i += <NUM_LIT:1><EOL><DEDENT>self.set_xlim((-<NUM_LIT>, <NUM_LIT>))<EOL>self.set_ylim((-<NUM_LIT>, <NUM_LIT>))<EOL>self.set_xticks([])<EOL>self.set_yticks([])<EOL>if autopct is None: return slices, texts<EOL>else: return slices, texts, autotexts<EOL>
r"""
        call signature::

          pie(x, explode=None, labels=None,
              colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
              autopct=None, pctdistance=0.6, labeldistance=1.1, shadow=False)

        Make a pie chart of array *x*.  The fractional area of each
        wedge is given by x/sum(x).  If sum(x) <= 1, then the values
        of x give the fractional area directly and the array will not
        be normalized.

        Keyword arguments:

          *explode*: [ None | len(x) sequence ]
            If not *None*, is a len(*x*) array which specifies the
            fraction of the radius with which to offset each wedge.

          *colors*: [ None | color sequence ]
            A sequence of matplotlib color args through which the pie chart
            will cycle.

          *labels*: [ None | len(x) sequence of strings ]
            A sequence of strings providing the labels for each wedge

          *autopct*: [ None | format string | format function ]
            If not *None*, is a string or function used to label the
            wedges with their numeric value.  The label will be placed inside
            the wedge.  If it is a format string, the label will be ``fmt%pct``.
            If it is a function, it will be called.

          *pctdistance*: scalar
            The ratio between the center of each pie slice and the
            start of the text generated by *autopct*.  Ignored if
            *autopct* is *None*; default is 0.6.

          *labeldistance*: scalar
            The radial distance at which the pie labels are drawn

          *shadow*: [ False | True ]
            Draw a shadow beneath the pie.

        The pie chart will probably look best if the figure and axes are
        square.  Eg.::

          figure(figsize=(8,8))
          ax = axes([0.1, 0.1, 0.8, 0.8])

        Return value:
          If *autopct* is None, return the tuple (*patches*, *texts*):

            - *patches* is a sequence of
              :class:`matplotlib.patches.Wedge` instances

            - *texts* is a list of the label
              :class:`matplotlib.text.Text` instances.

          If *autopct* is not *None*, return the tuple (*patches*,
          *texts*, *autotexts*), where *patches* and *texts* are as
          above, and *autotexts* is a list of
          :class:`~matplotlib.text.Text` instances for the numeric
          labels.