ax =  gcf().gca(**kwargs)<EOL>return ax<EOL>

Return the current axis instance.  This can be used to control
axis properties either using set or the
:class:`~matplotlib.axes.Axes` methods, for example, setting the
xaxis range::

  plot(t,s)
  set(gca(), 'xlim', [0,10])

or::

  plot(t,s)
  a = gca()
  a.set_xlim([0,10])


vertices = self.vertices<EOL>if not len(vertices):<EOL><INDENT>return<EOL><DEDENT>codes        = self.codes<EOL>len_vertices = len(vertices)<EOL>isfinite     = np.isfinite<EOL>NUM_VERTICES = self.NUM_VERTICES<EOL>MOVETO       = self.MOVETO<EOL>LINETO       = self.LINETO<EOL>CLOSEPOLY    = self.CLOSEPOLY<EOL>STOP         = self.STOP<EOL>if simplify is not None and self.should_simplify:<EOL><INDENT>polygons = self.to_polygons(None, *simplify)<EOL>for vertices in polygons:<EOL><INDENT>yield vertices[<NUM_LIT:0>], MOVETO<EOL>for v in vertices[<NUM_LIT:1>:]:<EOL><INDENT>yield v, LINETO<EOL><DEDENT><DEDENT><DEDENT>elif codes is None:<EOL><INDENT>if self.has_nonfinite:<EOL><INDENT>next_code = MOVETO<EOL>for v in vertices:<EOL><INDENT>if np.isfinite(v).all():<EOL><INDENT>yield v, next_code<EOL>next_code = LINETO<EOL><DEDENT>else:<EOL><INDENT>next_code = MOVETO<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>yield vertices[<NUM_LIT:0>], MOVETO<EOL>for v in vertices[<NUM_LIT:1>:]:<EOL><INDENT>yield v, LINETO<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>i = <NUM_LIT:0><EOL>was_nan = False<EOL>while i < len_vertices:<EOL><INDENT>code = codes[i]<EOL>if code == CLOSEPOLY:<EOL><INDENT>yield [], code<EOL>i += <NUM_LIT:1><EOL><DEDENT>elif code == STOP:<EOL><INDENT>return<EOL><DEDENT>else:<EOL><INDENT>num_vertices = NUM_VERTICES[int(code)]<EOL>curr_vertices = vertices[i:i+num_vertices].flatten()<EOL>if not isfinite(curr_vertices).all():<EOL><INDENT>was_nan = True<EOL><DEDENT>elif was_nan:<EOL><INDENT>yield curr_vertices[-<NUM_LIT:2>:], MOVETO<EOL>was_nan = False<EOL><DEDENT>else:<EOL><INDENT>yield curr_vertices, code<EOL><DEDENT>i += num_vertices<EOL><DEDENT><DEDENT><DEDENT>

Iterates over all of the curve segments in the path.  Each
iteration returns a 2-tuple (*vertices*, *code*), where
*vertices* is a sequence of 1 - 3 coordinate pairs, and *code* is
one of the :class:`Path` codes.

If *simplify* is provided, it must be a tuple (*width*,
*height*) defining the size of the figure, in native units
(e.g. pixels or points).  Simplification implies both removing
adjacent line segments that are very close to parallel, and
removing line segments outside of the figure.  The path will
be simplified *only* if :attr:`should_simplify` is True, which
is determined in the constructor by this criteria:

   - No curves
   - More than 128 vertices


def __init__(self, vertices, codes=None):

if ma.isMaskedArray(vertices):<EOL><INDENT>vertices = vertices.astype(np.float_).filled(np.nan)<EOL><DEDENT>else:<EOL><INDENT>vertices = np.asarray(vertices, np.float_)<EOL><DEDENT>if codes is not None:<EOL><INDENT>codes = np.asarray(codes, self.code_type)<EOL>assert codes.ndim == <NUM_LIT:1><EOL>assert len(codes) == len(vertices)<EOL><DEDENT>assert vertices.ndim == <NUM_LIT:2><EOL>assert vertices.shape[<NUM_LIT:1>] == <NUM_LIT:2><EOL>self.should_simplify = (len(vertices) >= <NUM_LIT> and<EOL>(codes is None or np.all(codes <= Path.LINETO)))<EOL>self.has_nonfinite = not np.isfinite(vertices).all()<EOL>self.codes = codes<EOL>self.vertices = vertices<EOL>

Create a new path with the given vertices and codes.

*vertices* is an Nx2 numpy float array, masked array or Python
sequence.

*codes* is an N-length numpy array or Python sequence of type
:attr:`matplotlib.path.Path.code_type`.

These two arrays must have the same length in the first
dimension.

If *codes* is None, *vertices* will be treated as a series of
line segments.

If *vertices* contains masked values, they will be converted
to NaNs which are then handled correctly by the Agg
PathIterator and other consumers of path data, such as
:meth:`iter_segments`.


from transforms import Bbox<EOL>if len(args[<NUM_LIT:1>]) == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return Bbox.from_extents(*_get_path_collection_extents(*args))<EOL>

Given a sequence of :class:`Path` objects, returns the bounding
box that encapsulates all of them.


if cls._unit_circle is None:<EOL><INDENT>MAGIC = <NUM_LIT><EOL>SQRTHALF = np.sqrt(<NUM_LIT:0.5>)<EOL>MAGIC45 = np.sqrt((MAGIC*MAGIC) / <NUM_LIT>)<EOL>vertices = np.array(<EOL>[[<NUM_LIT:0.0>, -<NUM_LIT:1.0>],<EOL>[MAGIC, -<NUM_LIT:1.0>],<EOL>[SQRTHALF-MAGIC45, -SQRTHALF-MAGIC45],<EOL>[SQRTHALF, -SQRTHALF],<EOL>[SQRTHALF+MAGIC45, -SQRTHALF+MAGIC45],<EOL>[<NUM_LIT:1.0>, -MAGIC],<EOL>[<NUM_LIT:1.0>, <NUM_LIT:0.0>],<EOL>[<NUM_LIT:1.0>, MAGIC],<EOL>[SQRTHALF+MAGIC45, SQRTHALF-MAGIC45],<EOL>[SQRTHALF, SQRTHALF],<EOL>[SQRTHALF-MAGIC45, SQRTHALF+MAGIC45],<EOL>[MAGIC, <NUM_LIT:1.0>],<EOL>[<NUM_LIT:0.0>, <NUM_LIT:1.0>],<EOL>[-MAGIC, <NUM_LIT:1.0>],<EOL>[-SQRTHALF+MAGIC45, SQRTHALF+MAGIC45],<EOL>[-SQRTHALF, SQRTHALF],<EOL>[-SQRTHALF-MAGIC45, SQRTHALF-MAGIC45],<EOL>[-<NUM_LIT:1.0>, MAGIC],<EOL>[-<NUM_LIT:1.0>, <NUM_LIT:0.0>],<EOL>[-<NUM_LIT:1.0>, -MAGIC],<EOL>[-SQRTHALF-MAGIC45, -SQRTHALF+MAGIC45],<EOL>[-SQRTHALF, -SQRTHALF],<EOL>[-SQRTHALF+MAGIC45, -SQRTHALF-MAGIC45],<EOL>[-MAGIC, -<NUM_LIT:1.0>],<EOL>[<NUM_LIT:0.0>, -<NUM_LIT:1.0>],<EOL>[<NUM_LIT:0.0>, -<NUM_LIT:1.0>]],<EOL>np.float_)<EOL>codes = cls.CURVE4 * np.ones(<NUM_LIT>)<EOL>codes[<NUM_LIT:0>] = cls.MOVETO<EOL>codes[-<NUM_LIT:1>] = cls.CLOSEPOLY<EOL>cls._unit_circle = Path(vertices, codes)<EOL><DEDENT>return cls._unit_circle<EOL>

(staticmethod) Returns a :class:`Path` of the unit circle.
The circle is approximated using cubic Bezier curves.  This
uses 8 splines around the circle using the approach presented
here:

  Lancaster, Don.  `Approximating a Circle or an Ellipse Using Four
  Bezier Cubic Splines <http://www.tinaja.com/glib/ellipse4.pdf>`_.


from transforms import Bbox<EOL>if transform is not None:<EOL><INDENT>transform = transform.frozen()<EOL><DEDENT>return Bbox(get_path_extents(self, transform))<EOL>

Returns the extents (*xmin*, *ymin*, *xmax*, *ymax*) of the
path.

Unlike computing the extents on the *vertices* alone, this
algorithm will take into account the curves and deal with
control points appropriately.


N = X.shape[<NUM_LIT:0>]<EOL>if self.orientation == '<STR_LIT>':<EOL><INDENT>return [list(zip(X[i], Y[i])) for i in range(<NUM_LIT:1>, N-<NUM_LIT:1>)]<EOL><DEDENT>else:<EOL><INDENT>return [list(zip(Y[i], X[i])) for i in range(<NUM_LIT:1>, N-<NUM_LIT:1>)]<EOL><DEDENT>

Return the separator line segments; helper for _add_solids.


N = self.cmap.N + <NUM_LIT:1><EOL>if self.extend == '<STR_LIT>':<EOL><INDENT>N += <NUM_LIT:2><EOL><DEDENT>elif self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>N += <NUM_LIT:1><EOL><DEDENT>return N<EOL>

Based on the colormap and extend variable, return the
number of boundaries.


ax = self.ax<EOL>ax.set_frame_on(False)<EOL>ax.set_navigate(False)<EOL>xy = self._outline(X, Y)<EOL>ax.update_datalim(xy)<EOL>ax.set_xlim(*ax.dataLim.intervalx)<EOL>ax.set_ylim(*ax.dataLim.intervaly)<EOL>self.outline = lines.Line2D(xy[:, <NUM_LIT:0>], xy[:, <NUM_LIT:1>], color=mpl.rcParams['<STR_LIT>'],<EOL>linewidth=mpl.rcParams['<STR_LIT>'])<EOL>ax.add_artist(self.outline)<EOL>self.outline.set_clip_box(None)<EOL>self.outline.set_clip_path(None)<EOL>c = mpl.rcParams['<STR_LIT>']<EOL>self.patch = patches.Polygon(xy, edgecolor=c,<EOL>facecolor=c,<EOL>linewidth=<NUM_LIT>,<EOL>zorder=-<NUM_LIT:1>)<EOL>ax.add_artist(self.patch)<EOL>ticks, ticklabels, offset_string = self._ticker()<EOL>if self.orientation == '<STR_LIT>':<EOL><INDENT>ax.set_xticks([])<EOL>ax.yaxis.set_label_position('<STR_LIT:right>')<EOL>ax.yaxis.set_ticks_position('<STR_LIT:right>')<EOL>ax.set_yticks(ticks)<EOL>ax.set_yticklabels(ticklabels)<EOL>ax.yaxis.get_major_formatter().set_offset_string(offset_string)<EOL><DEDENT>else:<EOL><INDENT>ax.set_yticks([])<EOL>ax.xaxis.set_label_position('<STR_LIT>')<EOL>ax.set_xticks(ticks)<EOL>ax.set_xticklabels(ticklabels)<EOL>ax.xaxis.get_major_formatter().set_offset_string(offset_string)<EOL><DEDENT>


if isinstance(self.norm, (colors.NoNorm, colors.BoundaryNorm)):<EOL><INDENT>b = self._boundaries<EOL>xn = x<EOL>xout = x<EOL><DEDENT>else:<EOL><INDENT>b = self.norm(self._boundaries, clip=False).filled()<EOL>xn = self.norm(x, clip=False).filled()<EOL>in_cond = (xn > -<NUM_LIT>) & (xn < <NUM_LIT>)<EOL>xn = np.compress(in_cond, xn)<EOL>xout = np.compress(in_cond, x)<EOL><DEDENT>y = self._y<EOL>N = len(b)<EOL>ii = np.minimum(np.searchsorted(b, xn), N-<NUM_LIT:1>)<EOL>i0 = np.maximum(ii - <NUM_LIT:1>, <NUM_LIT:0>)<EOL>db = np.take(b, ii) - np.take(b, i0)<EOL>db = np.where(i0==ii, <NUM_LIT:1.0>, db)<EOL>dy = np.take(y, ii) - np.take(y, i0)<EOL>z = np.take(y, i0) + (xn-np.take(b,i0))*dy/db<EOL>return xout, z<EOL>

Given a possible set of color data values, return the ones
within range, together with their corresponding colorbar
data coordinates.


x = np.array([<NUM_LIT:0.0>, <NUM_LIT:1.0>])<EOL>if self.spacing == '<STR_LIT>':<EOL><INDENT>y = self._uniform_y(self._central_N())<EOL><DEDENT>else:<EOL><INDENT>y = self._proportional_y()<EOL><DEDENT>self._y = y<EOL>X, Y = np.meshgrid(x,y)<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>X[<NUM_LIT:0>,:] = <NUM_LIT:0.5><EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>X[-<NUM_LIT:1>,:] = <NUM_LIT:0.5><EOL><DEDENT>return X, Y<EOL>

Return X,Y, the coordinate arrays for the colorbar pcolormesh.
These are suitable for a vertical colorbar; swapping and
transposition for a horizontal colorbar are done outside
this function.


locator = self.locator<EOL>formatter = self.formatter<EOL>if locator is None:<EOL><INDENT>if self.boundaries is None:<EOL><INDENT>if isinstance(self.norm, colors.NoNorm):<EOL><INDENT>nv = len(self._values)<EOL>base = <NUM_LIT:1> + int(nv/<NUM_LIT:10>)<EOL>locator = ticker.IndexLocator(base=base, offset=<NUM_LIT:0>)<EOL><DEDENT>elif isinstance(self.norm, colors.BoundaryNorm):<EOL><INDENT>b = self.norm.boundaries<EOL>locator = ticker.FixedLocator(b, nbins=<NUM_LIT:10>)<EOL><DEDENT>elif isinstance(self.norm, colors.LogNorm):<EOL><INDENT>locator = ticker.LogLocator()<EOL><DEDENT>else:<EOL><INDENT>locator = ticker.MaxNLocator()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>b = self._boundaries[self._inside]<EOL>locator = ticker.FixedLocator(b, nbins=<NUM_LIT:10>)<EOL><DEDENT><DEDENT>if isinstance(self.norm, colors.NoNorm):<EOL><INDENT>intv = self._values[<NUM_LIT:0>], self._values[-<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>intv = self.vmin, self.vmax<EOL><DEDENT>locator.create_dummy_axis()<EOL>formatter.create_dummy_axis()<EOL>locator.set_view_interval(*intv)<EOL>locator.set_data_interval(*intv)<EOL>formatter.set_view_interval(*intv)<EOL>formatter.set_data_interval(*intv)<EOL>b = np.array(locator())<EOL>b, ticks = self._locate(b)<EOL>formatter.set_locs(b)<EOL>ticklabels = [formatter(t, i) for i, t in enumerate(b)]<EOL>offset_string = formatter.get_offset()<EOL>return ticks, ticklabels, offset_string<EOL>

Return two sequences: ticks (colorbar data locations)
and ticklabels (strings).


b = self._boundaries[self._inside]<EOL>self.vmin = b[<NUM_LIT:0>]<EOL>self.vmax = b[-<NUM_LIT:1>]<EOL>

Set :attr:`vmin` and :attr:`vmax` attributes to the first and
last boundary excluding extended end boundaries.


if b is None:<EOL><INDENT>b = self.boundaries<EOL><DEDENT>if b is not None:<EOL><INDENT>self._boundaries = np.asarray(b, dtype=float)<EOL>if self.values is None:<EOL><INDENT>self._values = <NUM_LIT:0.5>*(self._boundaries[:-<NUM_LIT:1>]<EOL>+ self._boundaries[<NUM_LIT:1>:])<EOL>if isinstance(self.norm, colors.NoNorm):<EOL><INDENT>self._values = (self._values + <NUM_LIT>).astype(np.int16)<EOL><DEDENT>return<EOL><DEDENT>self._values = np.array(self.values)<EOL>return<EOL><DEDENT>if self.values is not None:<EOL><INDENT>self._values = np.array(self.values)<EOL>if self.boundaries is None:<EOL><INDENT>b = np.zeros(len(self.values)+<NUM_LIT:1>, '<STR_LIT:d>')<EOL>b[<NUM_LIT:1>:-<NUM_LIT:1>] = <NUM_LIT:0.5>*(self._values[:-<NUM_LIT:1>] - self._values[<NUM_LIT:1>:])<EOL>b[<NUM_LIT:0>] = <NUM_LIT>*b[<NUM_LIT:1>] - b[<NUM_LIT:2>]<EOL>b[-<NUM_LIT:1>] = <NUM_LIT>*b[-<NUM_LIT:2>] - b[-<NUM_LIT:3>]<EOL>self._boundaries = b<EOL>return<EOL><DEDENT>self._boundaries = np.array(self.boundaries)<EOL>return<EOL><DEDENT>if isinstance(self.norm, colors.NoNorm):<EOL><INDENT>b = self._uniform_y(self.cmap.N+<NUM_LIT:1>) * self.cmap.N - <NUM_LIT:0.5><EOL>v = np.zeros((len(b)-<NUM_LIT:1>,), dtype=np.int16)<EOL>v[self._inside] = np.arange(self.cmap.N, dtype=np.int16)<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>v[<NUM_LIT:0>] = -<NUM_LIT:1><EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>v[-<NUM_LIT:1>] = self.cmap.N<EOL><DEDENT>self._boundaries = b<EOL>self._values = v<EOL>return<EOL><DEDENT>elif isinstance(self.norm, colors.BoundaryNorm):<EOL><INDENT>b = list(self.norm.boundaries)<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>b = [b[<NUM_LIT:0>]-<NUM_LIT:1>] + b<EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>b = b + [b[-<NUM_LIT:1>] + <NUM_LIT:1>]<EOL><DEDENT>b = np.array(b)<EOL>v = np.zeros((len(b)-<NUM_LIT:1>,), dtype=float)<EOL>bi = self.norm.boundaries<EOL>v[self._inside] = <NUM_LIT:0.5>*(bi[:-<NUM_LIT:1>] + bi[<NUM_LIT:1>:])<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>v[<NUM_LIT:0>] = b[<NUM_LIT:0>] - <NUM_LIT:1><EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>v[-<NUM_LIT:1>] = b[-<NUM_LIT:1>] + <NUM_LIT:1><EOL><DEDENT>self._boundaries = b<EOL>self._values = v<EOL>return<EOL><DEDENT>else:<EOL><INDENT>if not self.norm.scaled():<EOL><INDENT>self.norm.vmin = <NUM_LIT:0><EOL>self.norm.vmax = <NUM_LIT:1><EOL><DEDENT>b = self.norm.inverse(self._uniform_y(self.cmap.N+<NUM_LIT:1>))<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>b[<NUM_LIT:0>] = b[<NUM_LIT:0>] - <NUM_LIT:1><EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>b[-<NUM_LIT:1>] = b[-<NUM_LIT:1>] + <NUM_LIT:1><EOL><DEDENT><DEDENT>self._process_values(b)<EOL>

Set the :attr:`_boundaries` and :attr:`_values` attributes
based on the input boundaries and values.  Input boundaries
can be *self.boundaries* or the argument *b*.


def add_lines(self, levels, colors, linewidths):

N = len(levels)<EOL>dummy, y = self._locate(levels)<EOL>if len(y) != N:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>x = np.array([<NUM_LIT:0.0>, <NUM_LIT:1.0>])<EOL>X, Y = np.meshgrid(x,y)<EOL>if self.orientation == '<STR_LIT>':<EOL><INDENT>xy = [list(zip(X[i], Y[i])) for i in range(N)]<EOL><DEDENT>else:<EOL><INDENT>xy = [list(zip(Y[i], X[i])) for i in range(N)]<EOL><DEDENT>col = collections.LineCollection(xy, linewidths=linewidths)<EOL>self.lines = col<EOL>col.set_color(colors)<EOL>self.ax.add_collection(col)<EOL>


<EOL>if self.orientation == '<STR_LIT>':<EOL><INDENT>args = (X, Y, C)<EOL><DEDENT>else:<EOL><INDENT>args = (np.transpose(Y), np.transpose(X), np.transpose(C))<EOL><DEDENT>kw = {'<STR_LIT>':self.cmap, '<STR_LIT>':self.norm,<EOL>'<STR_LIT>':'<STR_LIT>', '<STR_LIT>':self.alpha}<EOL>_hold = self.ax.ishold()<EOL>self.ax.hold(True)<EOL>col = self.ax.pcolor(*args, **kw)<EOL>self.ax.hold(_hold)<EOL>self.solids = col<EOL>if self.drawedges:<EOL><INDENT>self.dividers = collections.LineCollection(self._edges(X,Y),<EOL>colors=(mpl.rcParams['<STR_LIT>'],),<EOL>linewidths=(<NUM_LIT:0.5>*mpl.rcParams['<STR_LIT>'],)<EOL>)<EOL>self.ax.add_collection(self.dividers)<EOL><DEDENT>

Draw the colors using :meth:`~matplotlib.axes.Axes.pcolor`;
optionally add separators.


if not isinstance(CS, contour.ContourSet) or CS.filled:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>tcolors = [c[<NUM_LIT:0>] for c in CS.tcolors]<EOL>tlinewidths = [t[<NUM_LIT:0>] for t in CS.tlinewidths]<EOL>ColorbarBase.add_lines(self, CS.levels, tcolors, tlinewidths)<EOL>

Add the lines from a non-filled
:class:`~matplotlib.contour.ContourSet` to the colorbar.


def _auto_set_column_width(self, col, renderer):

cells = [key for key in self._cells if key[<NUM_LIT:1>] == col]<EOL>width = <NUM_LIT:0><EOL>for cell in cells:<EOL><INDENT>c = self._cells[cell]<EOL>width = max(c.get_required_width(renderer), width)<EOL><DEDENT>for cell in cells:<EOL><INDENT>self._cells[cell].set_width(width)<EOL><DEDENT>


for c in self._cells.itervalues():<EOL><INDENT>x, y = c.get_x(), c.get_y()<EOL>c.set_x(x+ox)<EOL>c.set_y(y+oy)<EOL><DEDENT>

Move all the artists by ox,oy (axes coords)


<EOL>widths = {}<EOL>heights = {}<EOL>for (row, col), cell in self._cells.iteritems():<EOL><INDENT>height = heights.setdefault(row, <NUM_LIT:0.0>)<EOL>heights[row] = max(height, cell.get_height())<EOL>width = widths.setdefault(col, <NUM_LIT:0.0>)<EOL>widths[col] = max(width, cell.get_width())<EOL><DEDENT>xpos = <NUM_LIT:0><EOL>lefts = {}<EOL>cols = widths.keys()<EOL>cols.sort()<EOL>for col in cols:<EOL><INDENT>lefts[col] = xpos<EOL>xpos += widths[col]<EOL><DEDENT>ypos = <NUM_LIT:0><EOL>bottoms = {}<EOL>rows = heights.keys()<EOL>rows.sort()<EOL>rows.reverse()<EOL>for row in rows:<EOL><INDENT>bottoms[row] = ypos<EOL>ypos += heights[row]<EOL><DEDENT>for (row, col), cell in self._cells.iteritems():<EOL><INDENT>cell.set_x(lefts[col])<EOL>cell.set_y(bottoms[row])<EOL><DEDENT>

Calculate row heights and column widths.

        Position cells accordingly.


def table(ax,<EOL>cellText=None, cellColours=None,<EOL>cellLoc='<STR_LIT:right>', colWidths=None,<EOL>rowLabels=None, rowColours=None, rowLoc='<STR_LIT:left>',<EOL>colLabels=None, colColours=None, colLoc='<STR_LIT>',<EOL>loc='<STR_LIT>', bbox=None):

<EOL>if cellText is None:<EOL><INDENT>rows = len(cellColours)<EOL>cols = len(cellColours[<NUM_LIT:0>])<EOL>cellText = [['<STR_LIT>'] * rows] * cols<EOL><DEDENT>rows = len(cellText)<EOL>cols = len(cellText[<NUM_LIT:0>])<EOL>for row in cellText:<EOL><INDENT>assert len(row) == cols<EOL><DEDENT>if cellColours is not None:<EOL><INDENT>assert len(cellColours) == rows<EOL>for row in cellColours:<EOL><INDENT>assert len(row) == cols<EOL><DEDENT><DEDENT>else:<EOL><INDENT>cellColours = ['<STR_LIT:w>' * cols] * rows<EOL><DEDENT>if colWidths is None:<EOL><INDENT>colWidths = [<NUM_LIT:1.0>/cols] * cols<EOL><DEDENT>rowLabelWidth = <NUM_LIT:0><EOL>if rowLabels is None:<EOL><INDENT>if rowColours is not None:<EOL><INDENT>rowLabels = ['<STR_LIT>'] * cols<EOL>rowLabelWidth = colWidths[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>elif rowColours is None:<EOL><INDENT>rowColours = '<STR_LIT:w>' * rows<EOL><DEDENT>if rowLabels is not None:<EOL><INDENT>assert len(rowLabels) == rows<EOL><DEDENT>offset = <NUM_LIT:0><EOL>if colLabels is None:<EOL><INDENT>if colColours is not None:<EOL><INDENT>colLabels = ['<STR_LIT>'] * rows<EOL>offset = <NUM_LIT:1><EOL><DEDENT><DEDENT>elif colColours is None:<EOL><INDENT>colColours = '<STR_LIT:w>' * cols<EOL>offset = <NUM_LIT:1><EOL><DEDENT>if rowLabels is not None:<EOL><INDENT>assert len(rowLabels) == rows<EOL><DEDENT>if cellColours is None:<EOL><INDENT>cellColours = ['<STR_LIT:w>' * cols] * rows<EOL><DEDENT>table = Table(ax, loc, bbox)<EOL>height = table._approx_text_height()<EOL>for row in xrange(rows):<EOL><INDENT>for col in xrange(cols):<EOL><INDENT>table.add_cell(row+offset, col,<EOL>width=colWidths[col], height=height,<EOL>text=cellText[row][col],<EOL>facecolor=cellColours[row][col],<EOL>loc=cellLoc)<EOL><DEDENT><DEDENT>if colLabels is not None:<EOL><INDENT>for col in xrange(cols):<EOL><INDENT>table.add_cell(<NUM_LIT:0>, col,<EOL>width=colWidths[col], height=height,<EOL>text=colLabels[col], facecolor=colColours[col],<EOL>loc=colLoc)<EOL><DEDENT><DEDENT>if rowLabels is not None:<EOL><INDENT>for row in xrange(rows):<EOL><INDENT>table.add_cell(row+offset, -<NUM_LIT:1>,<EOL>width=rowLabelWidth or <NUM_LIT>, height=height,<EOL>text=rowLabels[row], facecolor=rowColours[row],<EOL>loc=rowLoc)<EOL><DEDENT>if rowLabelWidth == <NUM_LIT:0>:<EOL><INDENT>table.auto_set_column_width(-<NUM_LIT:1>)<EOL><DEDENT><DEDENT>ax.add_table(table)<EOL>return table<EOL>

TABLE(cellText=None, cellColours=None,
      cellLoc='right', colWidths=None,
      rowLabels=None, rowColours=None, rowLoc='left',
      colLabels=None, colColours=None, colLoc='center',
      loc='bottom', bbox=None)

Factory function to generate a Table instance.

Thanks to John Gill for providing the class and table.


boxes = [self._cells[pos].get_window_extent(renderer)<EOL>for pos in self._cells.keys()<EOL>if pos[<NUM_LIT:0>] >= <NUM_LIT:0> and pos[<NUM_LIT:1>] >= <NUM_LIT:0>]<EOL>bbox = Bbox.union(boxes)<EOL>return bbox.inverse_transformed(self.get_transform())<EOL>

Get a bbox, in axes co-ordinates for the cells.

        Only include those in the range (0,0) to (maxRow, maxCol)


return self._cells.values()<EOL>

Return the Artists contained by the table


return silent_list('<STR_LIT>', self.texts)<EOL>

return a list of text.Text instance in the legend


if not self.get_visible(): return<EOL>self._update_legend_box(renderer)<EOL>renderer.open_group('<STR_LIT>')<EOL>if self._loc == <NUM_LIT:0>:<EOL><INDENT>_findoffset = self._findoffset_best<EOL><DEDENT>else:<EOL><INDENT>_findoffset = self._findoffset_loc<EOL><DEDENT>def findoffset(width, height, xdescent, ydescent):<EOL><INDENT>return _findoffset(width, height, xdescent, ydescent, renderer)<EOL><DEDENT>self._legend_box.set_offset(findoffset)<EOL>fontsize = renderer.points_to_pixels(self.fontsize)<EOL>if self._mode in ["<STR_LIT>"]:<EOL><INDENT>pad = <NUM_LIT:2>*(self.borderaxespad+self.borderpad)*fontsize<EOL>self._legend_box.set_width(self.parent.bbox.width-pad)<EOL><DEDENT>if self._drawFrame:<EOL><INDENT>bbox = self._legend_box.get_window_extent(renderer)<EOL>self.legendPatch.set_bounds(bbox.x0, bbox.y0,<EOL>bbox.width, bbox.height)<EOL>self.legendPatch.set_mutation_scale(fontsize)<EOL>if self.shadow:<EOL><INDENT>shadow = Shadow(self.legendPatch, <NUM_LIT:2>, -<NUM_LIT:2>)<EOL>shadow.draw(renderer)<EOL><DEDENT>self.legendPatch.draw(renderer)<EOL><DEDENT>self._legend_box.draw(renderer)<EOL>renderer.close_group('<STR_LIT>')<EOL>

Draw everything that belongs to the legend


self._drawFrame = b<EOL>


children = []<EOL>if self._legend_box:<EOL><INDENT>children.append(self._legend_box)<EOL><DEDENT>return children<EOL>


return self.legendPatch.get_window_extent()<EOL>


a.set_figure(self.figure)<EOL>for c in self.get_children():<EOL><INDENT>c.set_figure(self.figure)<EOL><DEDENT>a.set_transform(self.get_transform())<EOL>

set the boilerplate props for artists added to axes


def _findoffset_best(self, width, height, xdescent, ydescent, renderer):

ox, oy = self._find_best_position(width, height, renderer)<EOL>return ox+xdescent, oy+ydescent<EOL>

Heper function to locate the legend at its best position


if renderer is None:<EOL><INDENT>return self.fontsize<EOL><DEDENT>else:<EOL><INDENT>return renderer.points_to_pixels(self.fontsize)<EOL><DEDENT>

Return the approximate height of the text. This is used to place
the legend handle.


return self.legendPatch<EOL>

return the Rectangle instance used to frame the legend


self._extent = extent<EOL>xmin, xmax, ymin, ymax = extent<EOL>corners = (xmin, ymin), (xmax, ymax)<EOL>self.axes.update_datalim(corners)<EOL>if self.axes._autoscaleon:<EOL><INDENT>self.axes.set_xlim((xmin, xmax))<EOL>self.axes.set_ylim((ymin, ymax))<EOL><DEDENT>

extent is data axes (left, right, bottom, top) for making image plots


im = self.make_image()<EOL>rows, cols, buffer = im.as_rgba_str()<EOL>_png.write_png(buffer, cols, rows, fname)<EOL>


return self._filternorm<EOL>


retained for backwards compatibility - use set_data instead

ACCEPTS: numpy array A or PIL Image


r = float(filterrad)<EOL>assert(r><NUM_LIT:0>)<EOL>self._filterrad = r<EOL>

Set the resize filter radius only applicable to some
        interpolation schemes -- see help for imshow

        ACCEPTS: positive float


self._imcache = None<EOL>self._rgbacache = None<EOL>cm.ScalarMappable.changed(self)<EOL>

Call this whenever the mappable is changed so observers can
update state


<EOL>if hasattr(A,'<STR_LIT>'):<EOL><INDENT>self._A = pil_to_array(A)<EOL><DEDENT>elif ma.isMA(A):<EOL><INDENT>self._A = A<EOL><DEDENT>else:<EOL><INDENT>self._A = np.asarray(A) <EOL><DEDENT>if self._A.dtype != np.uint8 and not np.can_cast(self._A.dtype, np.float):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if (self._A.ndim not in (<NUM_LIT:2>, <NUM_LIT:3>) or<EOL>(self._A.ndim == <NUM_LIT:3> and self._A.shape[-<NUM_LIT:1>] not in (<NUM_LIT:3>, <NUM_LIT:4>))):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>self._imcache =None<EOL>self._rgbacache = None<EOL>self._oldxslice = None<EOL>self._oldyslice = None<EOL>

Set the image array

ACCEPTS: numpy/PIL Image A


def __init__(self, ax,<EOL>cmap = None,<EOL>norm = None,<EOL>interpolation=None,<EOL>origin=None,<EOL>extent=None,<EOL>filternorm=<NUM_LIT:1>,<EOL>filterrad=<NUM_LIT>,<EOL>resample = False,<EOL>**kwargs<EOL>):

martist.Artist.__init__(self)<EOL>cm.ScalarMappable.__init__(self, norm, cmap)<EOL>if origin is None: origin = rcParams['<STR_LIT>']<EOL>self.origin = origin<EOL>self._extent = extent<EOL>self.set_filternorm(filternorm)<EOL>self.set_filterrad(filterrad)<EOL>self._filterrad = filterrad<EOL>self.set_interpolation(interpolation)<EOL>self.set_resample(resample)<EOL>self.axes = ax<EOL>self._imcache = None<EOL>self.update(kwargs)<EOL>

interpolation and cmap default to their rc settings

cmap is a colors.Colormap instance
norm is a colors.Normalize instance to map luminance to 0-1

extent is data axes (left, right, bottom, top) for making image plots
registered with data plots.  Default is to label the pixel
centers with the zero-based row and column indices.

Additional kwargs are matplotlib.artist properties


props = []<EOL>families = '<STR_LIT>'<EOL>size = '<STR_LIT>'<EOL>for key in '<STR_LIT>'.split():<EOL><INDENT>val = getattr(d, '<STR_LIT>' + key)()<EOL>if val is not None and val != []:<EOL><INDENT>if type(val) == list:<EOL><INDENT>val = [value_escape(r'<STR_LIT>', str(x)) for x in val if x is not None]<EOL>if val != []:<EOL><INDENT>val = '<STR_LIT:U+002C>'.join(val)<EOL><DEDENT><DEDENT>props.append("<STR_LIT>" % (key, val))<EOL><DEDENT><DEDENT>return '<STR_LIT>'.join(props)<EOL>

Given a dictionary of key/value pairs, generates a fontconfig
pattern string.


assert len(self.events)><NUM_LIT:0>, "<STR_LIT>"<EOL>if self.events[-<NUM_LIT:1>].name == '<STR_LIT>':<EOL><INDENT>self.key_event()<EOL><DEDENT>else:<EOL><INDENT>self.mouse_event()<EOL><DEDENT>


if event.inaxes:<EOL><INDENT>self.add_click(event)<EOL><DEDENT>else: <EOL><INDENT>BlockingInput.pop(self)<EOL><DEDENT>

Will be called for any event involving a button other than
button 2 or 3.  This will add a click if it is inside axes.


self.events.append(event)<EOL>

For base class, this just appends an event to events.


self.events.pop(index)<EOL>

This removes an event from the event list.  Defaults to
removing last event, but an index can be supplied.  Note that
this does not check that there are events, much like the
normal pop method.  If not events exist, this will throw an
exception.


self.clicks.pop(index)<EOL>if self.show_clicks:<EOL><INDENT>mark = self.marks.pop(index)<EOL>mark.remove()<EOL>self.fig.canvas.draw()<EOL><DEDENT>

This removes a click from the list of clicks.  Defaults to
removing the last click.


event = self.events[-<NUM_LIT:1>]<EOL>button = event.button<EOL>if button == <NUM_LIT:3>:<EOL><INDENT>self.button3(event)<EOL><DEDENT>elif button == <NUM_LIT:2>:<EOL><INDENT>self.button2(event)<EOL><DEDENT>else:<EOL><INDENT>self.button1(event)<EOL><DEDENT>


<EOL>BlockingInput.pop(self)<EOL>if self.inline:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>self.cs.pop_label()<EOL>self.cs.ax.figure.canvas.draw()<EOL><DEDENT>

This will be called if button 3 is clicked.  This will remove
a label if not in inline mode.  Unfortunately, if one is doing
inline labels, then there is currently no way to fix the
broken contour - once humpty-dumpty is broken, he can't be put
back together.  In inline mode, this does nothing.


self.pop_click(index)<EOL>BlockingInput.pop(self,index)<EOL>

This removes a click and the associated event from the object.
Defaults to removing the last click, but any index can be
supplied.


def __call__(self, n=<NUM_LIT:1>, timeout=<NUM_LIT:30>, show_clicks=True):

self.show_clicks = show_clicks<EOL>self.clicks      = []<EOL>self.marks       = []<EOL>BlockingInput.__call__(self,n=n,timeout=timeout)<EOL>return self.clicks<EOL>

Blocking call to retrieve n coordinate pairs through mouse
clicks.


self.keyormouse = None<EOL>BlockingInput.__call__(self,n=<NUM_LIT:1>,timeout=timeout)<EOL>return self.keyormouse<EOL>

Blocking call to retrieve a single mouse or key click
Returns True if key click, False if mouse, or None if timeout


return self.set_antialiased(aa)<EOL>


transform = self.get_transform()<EOL>transOffset = self._transOffset<EOL>offsets = self._offsets<EOL>paths = self.get_paths()<EOL>if self.have_units():<EOL><INDENT>paths = []<EOL>for path in self.get_paths():<EOL><INDENT>vertices = path.vertices<EOL>xs, ys = vertices[:, <NUM_LIT:0>], vertices[:, <NUM_LIT:1>]<EOL>xs = self.convert_xunits(xs)<EOL>ys = self.convert_yunits(ys)<EOL>paths.append(mpath.Path(zip(xs, ys), path.codes))<EOL><DEDENT>if len(self._offsets):<EOL><INDENT>xs = self.convert_xunits(self._offsets[:<NUM_LIT:0>])<EOL>ys = self.convert_yunits(self._offsets[:<NUM_LIT:1>])<EOL>offsets = zip(xs, ys)<EOL><DEDENT><DEDENT>offsets = np.asarray(offsets, np.float_)<EOL>if not transform.is_affine:<EOL><INDENT>paths = [transform.transform_path_non_affine(<EOL>path) for path in paths]<EOL>transform = transform.get_affine()<EOL><DEDENT>if not transOffset.is_affine:<EOL><INDENT>offsets = transOffset.transform_non_affine(offsets)<EOL>transOffset = transOffset.get_affine()<EOL><DEDENT>return transform, transOffset, offsets, paths<EOL>


def set_verts(self, verts, closed=True):

if closed:<EOL><INDENT>self._paths = []<EOL>for xy in verts:<EOL><INDENT>if np.ma.isMaskedArray(xy):<EOL><INDENT>if len(xy) and (xy[<NUM_LIT:0>] != xy[-<NUM_LIT:1>]).any():<EOL><INDENT>xy = np.ma.concatenate([xy, [xy[<NUM_LIT:0>]]])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>xy = np.asarray(xy)<EOL>if len(xy) and (xy[<NUM_LIT:0>] != xy[-<NUM_LIT:1>]).any():<EOL><INDENT>xy = np.concatenate([xy, [xy[<NUM_LIT:0>]]])<EOL><DEDENT><DEDENT>self._paths.append(mpath.Path(xy))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self._paths = [mpath.Path(xy) for xy in verts]<EOL><DEDENT>

This allows one to delay initialization of the vertices.


def __init__(self, verts, sizes=None, closed=True, **kwargs):

Collection.__init__(self, **kwargs)<EOL>self._sizes = sizes<EOL>self.set_verts(verts, closed)<EOL>

*verts* is a sequence of ( *verts0*, *verts1*, ...) where
*verts_i* is a sequence of *xy* tuples of vertices, or an
equivalent :mod:`numpy` array of shape (*nv*, 2).

*sizes* is *None* (default) or a sequence of floats that
scale the corresponding *verts_i*.  The scaling is applied
before the Artist master transform; if the latter is an identity
transform, then the overall scaling is such that if
*verts_i* specify a unit square, then *sizes_i* is the area
of that square in points^2.
If len(*sizes*) < *nv*, the additional values will be
taken cyclically from the array.

*closed*, when *True*, will explicitly close the polygon.

%(Collection)s


return self.set_linestyle(ls)<EOL>


def __init__(self, patches, match_original=False, **kwargs):

if match_original:<EOL><INDENT>def determine_facecolor(patch):<EOL><INDENT>if patch.fill:<EOL><INDENT>return patch.get_facecolor()<EOL><DEDENT>return [<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>]<EOL><DEDENT>facecolors = [determine_facecolor(p) for p in patches]<EOL>edgecolors = [p.get_edgecolor() for p in patches]<EOL>linewidths = [p.get_linewidths() for p in patches]<EOL>antialiaseds = [p.get_antialiased() for p in patches]<EOL>Collection.__init__(<EOL>self,<EOL>edgecolors=edgecolors,<EOL>facecolors=facecolors,<EOL>linewidths=linewidths,<EOL>linestyles='<STR_LIT>',<EOL>antialiaseds=antialiaseds)<EOL><DEDENT>else:<EOL><INDENT>Collection.__init__(self, **kwargs)<EOL><DEDENT>paths = [p.get_transform().transform_path(p.get_path())<EOL>for p in patches]<EOL>self._paths = paths<EOL>

*patches*
    a sequence of Patch objects.  This list may include
    a heterogeneous assortment of different patch types.

*match_original*
    If True, use the colors and linewidths of the original
    patches.  If False, new colors may be assigned by
    providing the standard collection arguments, facecolor,
    edgecolor, linewidths, norm or cmap.

If any of *edgecolors*, *facecolors*, *linewidths*,
*antialiaseds* are None, they default to their
:data:`matplotlib.rcParams` patch setting, in sequence form.

The use of :class:`~matplotlib.cm.ScalarMappable` is optional.
If the :class:`~matplotlib.cm.ScalarMappable` matrix _A is not
None (ie a call to set_array has been made), at draw time a
call to scalar mappable will be made to set the face colors.


artist.Artist.update_from(self, other)<EOL>self._antialiaseds = other._antialiaseds<EOL>self._edgecolors_original = other._edgecolors_original<EOL>self._edgecolors = other._edgecolors<EOL>self._facecolors_original = other._facecolors_original<EOL>self._facecolors = other._facecolors<EOL>self._linewidths = other._linewidths<EOL>self._linestyles = other._linestyles<EOL>self._pickradius = other._pickradius<EOL>


return self.set_linewidth(lw)<EOL>


self.set_facecolor(c)<EOL>self.set_edgecolor(c)<EOL>

Set both the edgecolor and the facecolor.

ACCEPTS: matplotlib color arg or sequence of rgba tuples

.. seealso::
    :meth:`set_facecolor`, :meth:`set_edgecolor`


if self._A is None:<EOL><INDENT>return<EOL><DEDENT>if self._A.ndim > <NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if len(self._facecolors):<EOL><INDENT>self._facecolors = self.to_rgba(self._A, self._alpha)<EOL><DEDENT>else:<EOL><INDENT>self._edgecolors = self.to_rgba(self._A, self._alpha)<EOL><DEDENT>

If the scalar mappable array is not none, update colors
from scalar data


self._edgecolors = _colors.colorConverter.to_rgba_array(c)<EOL>

Set the color(s) of the line collection.  *c* can be a
matplotlib color arg (all patches have same color), or a
sequence or rgba tuples; if it is a sequence the patches will
cycle through the sequence

ACCEPTS: matplotlib color arg or sequence of rgba tuples


if c is None:<EOL><INDENT>c = mpl.rcParams['<STR_LIT>']<EOL><DEDENT>self._facecolors_original = c<EOL>self._facecolors = _colors.colorConverter.to_rgba_array(c, self._alpha)<EOL>

Set the facecolor(s) of the collection.  *c* can be a
matplotlib color arg (all patches have same color), or a
sequence or rgba tuples; if it is a sequence the patches will
cycle through the sequence

ACCEPTS: matplotlib color arg or sequence of rgba tuples


return self.get_antialiased()<EOL>


return self.pickradius<EOL>

return the pick radius used for containment tests


return self._solidjoinstyle<EOL>


<EOL>for ds in flatten([list(k.keys()) for k in (self._drawStyles_l,<EOL>self._drawStyles_s)], is_string_like):<EOL><INDENT>if linestyle.startswith(ds):<EOL><INDENT>self.set_drawstyle(ds)<EOL>if len(linestyle) > len(ds):<EOL><INDENT>linestyle = linestyle[len(ds):]<EOL><DEDENT>else:<EOL><INDENT>linestyle = '<STR_LIT:->'<EOL><DEDENT><DEDENT><DEDENT>if linestyle not in self._lineStyles:<EOL><INDENT>if linestyle in ls_mapper:<EOL><INDENT>linestyle = ls_mapper[linestyle]<EOL><DEDENT>else:<EOL><INDENT>verbose.report('<STR_LIT>' %<EOL>(linestyle, type(linestyle)))<EOL><DEDENT><DEDENT>if linestyle in ['<STR_LIT:U+0020>','<STR_LIT>']:<EOL><INDENT>linestyle = '<STR_LIT:None>'<EOL><DEDENT>self._linestyle = linestyle<EOL>

Set the linestyle of the line (also accepts drawstyles)

================    =================
linestyle           description
================    =================
'-'                 solid
'--'                dashed
'-.'                dash_dot
':'                 dotted
'None'              draw nothing
' '                 draw nothing
''                  draw nothing
================    =================

'steps' is equivalent to 'steps-pre' and is maintained for
backward-compatibility.

.. seealso::
    :meth:`set_drawstyle`

ACCEPTS: [ '-' | '--' | '-.' | ':' | 'None' | ' ' | '' ] and
any drawstyle in combination with a linestyle, e.g. 'steps--'.


return self.get_markeredgecolor()<EOL>


Artist.update_from(self, other)<EOL>self._linestyle = other._linestyle<EOL>self._linewidth = other._linewidth<EOL>self._color = other._color<EOL>self._markersize = other._markersize<EOL>self._markerfacecolor = other._markerfacecolor<EOL>self._markeredgecolor = other._markeredgecolor<EOL>self._markeredgewidth = other._markeredgewidth<EOL>self._dashSeq = other._dashSeq<EOL>self._dashcapstyle = other._dashcapstyle<EOL>self._dashjoinstyle = other._dashjoinstyle<EOL>self._solidcapstyle = other._solidcapstyle<EOL>self._solidjoinstyle = other._solidjoinstyle<EOL>self._linestyle = other._linestyle<EOL>self._marker = other._marker<EOL>self._drawstyle = other._drawstyle<EOL>


if len(args)==<NUM_LIT:1>:<EOL><INDENT>x, y = args[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>x, y = args<EOL><DEDENT>not_masked = <NUM_LIT:0><EOL>if not ma.isMaskedArray(x):<EOL><INDENT>x = np.asarray(x)<EOL>not_masked += <NUM_LIT:1><EOL><DEDENT>if not ma.isMaskedArray(y):<EOL><INDENT>y = np.asarray(y)<EOL>not_masked += <NUM_LIT:1><EOL><DEDENT>if (not_masked < <NUM_LIT:2> or<EOL>(x is not self._xorig and<EOL>(x.shape != self._xorig.shape or np.any(x != self._xorig))) or<EOL>(y is not self._yorig and<EOL>(y.shape != self._yorig.shape or np.any(y != self._yorig)))):<EOL><INDENT>self._xorig = x<EOL>self._yorig = y<EOL>self._invalid = True<EOL><DEDENT>


return self.get_linewidth()<EOL>


return self.get_markeredgewidth()<EOL>


if self._invalid:<EOL><INDENT>self.recache()<EOL><DEDENT>return self._path<EOL>

Return the :class:`~matplotlib.path.Path` object associated
with this line.


s = s.lower()<EOL>if s not in self.validJoin:<EOL><INDENT>raise ValueError('<STR_LIT>' % (s,)<EOL>+ '<STR_LIT>' % (self.validJoin,))<EOL><DEDENT>self._dashjoinstyle = s<EOL>

Set the join style for dashed linestyles
ACCEPTS: ['miter' | 'round' | 'bevel']


if orig:<EOL><INDENT>return self._yorig<EOL><DEDENT>if self._invalid:<EOL><INDENT>self.recache()<EOL><DEDENT>return self._y<EOL>

Return the ydata.

If *orig* is *True*, return the original data, else the
processed data.


if seq == (None, None) or len(seq)==<NUM_LIT:0>:<EOL><INDENT>self.set_linestyle('<STR_LIT:->')<EOL><DEDENT>else:<EOL><INDENT>self.set_linestyle('<STR_LIT>')<EOL><DEDENT>self._dashSeq = seq<EOL>

Set the dash sequence, sequence of dashes with on off ink in
points.  If seq is empty or if seq = (None, None), the
linestyle will be set to solid.

ACCEPTS: sequence of on/off ink in points


return self.get_markerfacecolor()<EOL>


Artist.set_transform(self, t)<EOL>self._invalid = True<EOL>

set the Transformation instance used by this artist

ACCEPTS: a :class:`matplotlib.transforms.Transform` instance


if not hasattr(line, '<STR_LIT>'):<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>if line.get_picker() is None:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>self.axes = line.axes<EOL>self.line = line<EOL>self.canvas = self.axes.figure.canvas<EOL>self.cid = self.canvas.mpl_connect('<STR_LIT>', self.onpick)<EOL>self.ind = set()<EOL>

Initialize the class with a :class:`matplotlib.lines.Line2D`
instance.  The line should already be added to some
:class:`matplotlib.axes.Axes` instance and should have the
picker property set.


return self._dashcapstyle<EOL>


if orig:<EOL><INDENT>return self._xorig<EOL><DEDENT>if self._invalid:<EOL><INDENT>self.recache()<EOL><DEDENT>return self._x<EOL>

Return the xdata.

If *orig* is *True*, return the original data, else the
processed data.


s = s.lower()<EOL>if s not in self.validCap:<EOL><INDENT>raise ValueError('<STR_LIT>' % (s,)<EOL>+ '<STR_LIT>' % (self.validCap,))<EOL><DEDENT>self._dashcapstyle = s<EOL>

Set the cap style for dashed linestyles

ACCEPTS: ['butt' | 'round' | 'projecting']


s = s.lower()<EOL>if s not in self.validCap:<EOL><INDENT>raise ValueError('<STR_LIT>' % (s,)<EOL>+ '<STR_LIT>' % (self.validCap,))<EOL><DEDENT>self._solidcapstyle = s<EOL>

Set the cap style for solid linestyles

ACCEPTS: ['butt' | 'round' |  'projecting']


return False<EOL>

Return True if this axes support the zoom box


number = (<NUM_LIT> / degrees) + <NUM_LIT:1><EOL>self.yaxis.set_major_locator(<EOL>FixedLocator(<EOL>np.linspace(-np.pi / <NUM_LIT>, np.pi / <NUM_LIT>, number, True)[<NUM_LIT:1>:-<NUM_LIT:1>]))<EOL>self._latitude_degrees = degrees<EOL>self.yaxis.set_major_formatter(self.ThetaFormatter(degrees))<EOL>

Set the number of degrees between each longitude grid.


number = (<NUM_LIT> / degrees) + <NUM_LIT:1><EOL>self.xaxis.set_major_locator(<EOL>FixedLocator(<EOL>np.linspace(-np.pi, np.pi, number, True)[<NUM_LIT:1>:-<NUM_LIT:1>]))<EOL>self._logitude_degrees = degrees<EOL>self.xaxis.set_major_formatter(self.ThetaFormatter(degrees))<EOL>


return False<EOL>


def set_thetagrids(self, angles, labels=None, frac=None,<EOL>**kwargs):

angles = npy.asarray(angles, npy.float_)<EOL>self.set_xticks(angles * (npy.pi / <NUM_LIT>))<EOL>if labels is not None:<EOL><INDENT>self.set_xticklabels(labels)<EOL><DEDENT>if frac is not None:<EOL><INDENT>self._theta_label1_position.clear().translate(<NUM_LIT:0.0>, frac)<EOL>self._theta_label2_position.clear().translate(<NUM_LIT:0.0>, <NUM_LIT:1.0> / frac)<EOL><DEDENT>for t in self.xaxis.get_ticklabels():<EOL><INDENT>t.update(kwargs)<EOL><DEDENT>return self.xaxis.get_ticklines(), self.xaxis.get_ticklabels()<EOL>

Set the angles at which to place the theta grids (these
gridlines are equal along the theta dimension).  *angles* is in
degrees.

*labels*, if not None, is a ``len(angles)`` list of strings of
the labels to use at each angle.

If *labels* is None, the labels will be ``fmt %% angle``

*frac* is the fraction of the polar axes radius at which to
place the label (1 is the edge). Eg. 1.05 is outside the axes
and 0.95 is inside the axes.

Return value is a list of tuples (*line*, *label*), where
*line* is :class:`~matplotlib.lines.Line2D` instances and the
*label* is :class:`~matplotlib.text.Text` instances.

kwargs are optional text properties for the labels:

%(Text)s

ACCEPTS: sequence of floats


def projection_factory(projection, figure, rect, **kwargs):

return get_projection_class(projection)(figure, rect, **kwargs)<EOL>

Get a new projection instance.

*projection* is a projection name.

*figure* is a figure to add the axes to.

*rect* is a :class:`~matplotlib.transforms.Bbox` object specifying
the location of the axes within the figure.

Any other kwargs are passed along to the specific projection
constructor being used.


return self._all_projection_types[name]<EOL>


for projection in projections:<EOL><INDENT>name = projection.name<EOL>self._all_projection_types[name] = projection<EOL><DEDENT>


if self._rc_cache is None:<EOL><INDENT>self._rc_cache = dict([(k,None) for k in self._rc_cache_keys])<EOL><DEDENT>changed = [par for par in self._rc_cache_keys if rcParams[par] !=self._rc_cache[par]]<EOL>if changed:<EOL><INDENT>if DEBUG: print('<STR_LIT>', changed)<EOL>for k in changed:<EOL><INDENT>if DEBUG:<EOL><INDENT>print('<STR_LIT>' %(k, self._rc_cache[k], rcParams[k]))<EOL><DEDENT>self._rc_cache[k] = copy.deepcopy(rcParams[k])<EOL><DEDENT>if DEBUG: print('<STR_LIT>', self._fontconfig)<EOL>self.__init__()<EOL><DEDENT>if DEBUG: print('<STR_LIT>', self._fontconfig)<EOL>return self._fontconfig<EOL>

Reinitializes self if relevant rcParams on have changed.


def get_grey(self, tex, fontsize=None, dpi=None):

key = tex, self.get_font_config(), fontsize, dpi<EOL>alpha = self.grey_arrayd.get(key)<EOL>if alpha is None:<EOL><INDENT>pngfile = self.make_png(tex, fontsize, dpi)<EOL>X = read_png(os.path.join(self.texcache, pngfile))<EOL>if rcParams['<STR_LIT>'] is not None:<EOL><INDENT>hack = rcParams['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>hack = self._dvipng_hack_alpha<EOL><DEDENT>if hack:<EOL><INDENT>alpha = <NUM_LIT:1>-X[:,:,<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>alpha = X[:,:,-<NUM_LIT:1>]<EOL><DEDENT>self.grey_arrayd[key] = alpha<EOL><DEDENT>return alpha<EOL>


if sys.platform == '<STR_LIT:win32>':<EOL><INDENT>command = ['<STR_LIT:%s>'% os.path.splitdrive(self.texcache)[<NUM_LIT:0>]]<EOL><DEDENT>else:<EOL><INDENT>command = []<EOL><DEDENT>command.extend(args)<EOL>return '<STR_LIT>'.join(command)<EOL>

On windows, changing directories can be complicated by the presence of
multiple drives. get_shell_cmd deals with this issue.


def get_rgba(self, tex, fontsize=None, dpi=None, rgb=(<NUM_LIT:0>,<NUM_LIT:0>,<NUM_LIT:0>)):

if not fontsize: fontsize = rcParams['<STR_LIT>']<EOL>if not dpi: dpi = rcParams['<STR_LIT>']<EOL>r,g,b = rgb<EOL>key = tex, self.get_font_config(), fontsize, dpi, tuple(rgb)<EOL>Z = self.rgba_arrayd.get(key)<EOL>if Z is None:<EOL><INDENT>alpha = self.get_grey(tex, fontsize, dpi)<EOL>Z = np.zeros((alpha.shape[<NUM_LIT:0>], alpha.shape[<NUM_LIT:1>], <NUM_LIT:4>), np.float)<EOL>Z[:,:,<NUM_LIT:0>] = r<EOL>Z[:,:,<NUM_LIT:1>] = g<EOL>Z[:,:,<NUM_LIT:2>] = b<EOL>Z[:,:,<NUM_LIT:3>] = alpha<EOL>self.rgba_arrayd[key] = Z<EOL><DEDENT>return Z<EOL>

Returns latex's rendering of the tex string as an rgba array


def get_basefile(self, tex, fontsize, dpi=None):

s = '<STR_LIT>'.join([tex, self.get_font_config(), '<STR_LIT>'%fontsize,<EOL>self.get_custom_preamble(), str(dpi or '<STR_LIT>')])<EOL>bytes = str(s).encode('<STR_LIT:utf-8>')<EOL>return os.path.join(self.texcache, md5(bytes).hexdigest())<EOL>

returns a filename based on a hash of the string, fontsize, and dpi


return self._font_preamble<EOL>

returns a string containing font configuration for the tex preamble


ax1, ay1, ax2, ay2 = self._get_extents()<EOL>bx1, by1, bx2, by2 = other._get_extents()<EOL>if ax2 < ax1:<EOL><INDENT>ax2, ax1 = ax1, ax2<EOL><DEDENT>if ay2 < ay1:<EOL><INDENT>ay2, ay1 = ay1, ay2<EOL><DEDENT>if bx2 < bx1:<EOL><INDENT>bx2, bx1 = bx1, bx2<EOL><DEDENT>if by2 < by1:<EOL><INDENT>by2, by1 = by1, by2<EOL><DEDENT>return not ((bx2 <= ax1) or<EOL>(by2 <= ay1) or<EOL>(bx1 >= ax2) or<EOL>(by1 >= ay2))<EOL>

Returns True if this bounding box overlaps with the given
bounding box *other*, but not on its edge alone.


if isinstance(other, Transform):<EOL><INDENT>return composite_transform_factory(other, self)<EOL><DEDENT>raise TypeError(<EOL>"<STR_LIT>" % type(other))<EOL>

Composes two transforms together such that *self* is followed
by *other*.


assert(len(bboxes))<EOL>if len(bboxes) == <NUM_LIT:1>:<EOL><INDENT>return bboxes[<NUM_LIT:0>]<EOL><DEDENT>x0 = np.inf<EOL>y0 = np.inf<EOL>x1 = -np.inf<EOL>y1 = -np.inf<EOL>for bbox in bboxes:<EOL><INDENT>points = bbox.get_points()<EOL>xs = points[:, <NUM_LIT:0>]<EOL>ys = points[:, <NUM_LIT:1>]<EOL>x0 = min(x0, np.min(xs))<EOL>y0 = min(y0, np.min(ys))<EOL>x1 = max(x1, np.max(xs))<EOL>y1 = max(y1, np.max(ys))<EOL><DEDENT>return Bbox.from_extents(x0, y0, x1, y1)<EOL>

Return a :class:`Bbox` that contains all of the given bboxes.


boxes = []<EOL>yf = [<NUM_LIT:0>] + list(args) + [<NUM_LIT:1>]<EOL>x0, y0, x1, y1 = self._get_extents()<EOL>h = y1 - y0<EOL>for yf0, yf1 in zip(yf[:-<NUM_LIT:1>], yf[<NUM_LIT:1>:]):<EOL><INDENT>boxes.append(Bbox([[x0, y0 + yf0 * h], [x1, y0 + yf1 * h]]))<EOL><DEDENT>return boxes<EOL>

e.g., ``bbox.splitx(f1, f2, ...)``

Returns a list of new :class:`Bbox` objects formed by
splitting the original one with horizontal lines at fractional
positions *f1*, *f2*, ...


x0, x1 = self.intervalx<EOL>return ((x0 < x1<EOL>and (x >= x0 and x <= x1))<EOL>or (x >= x1 and x <= x0))<EOL>

Returns True if *x* is between or equal to :attr:`x0` and
:attr:`x1`.


return Bbox(transform.transform(self.get_points()))<EOL>

Return a new :class:`Bbox` object, statically transformed by
the given transform.


assert child.input_dims == self.input_dims<EOL>assert child.output_dims == self.output_dims<EOL>self._set(child)<EOL>self._invalid = <NUM_LIT:0><EOL>self.invalidate()<EOL>self._invalid = <NUM_LIT:0><EOL>

Replace the current child of this transform with another one.

The new child must have the same number of input and output
dimensions as the current child.


return self.transform(values)<EOL>

Performs only the non-affine part of the transformation.

``transform(values)`` is always equivalent to
``transform_affine(transform_non_affine(values))``.

In non-affine transformations, this is generally equivalent to
``transform(values)``.  In affine transformations, this is
always a no-op.

Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).


def shrunk_to_aspect(self, box_aspect, container = None, fig_aspect = <NUM_LIT:1.0>):

assert box_aspect > <NUM_LIT:0> and fig_aspect > <NUM_LIT:0><EOL>if container is None:<EOL><INDENT>container = self<EOL><DEDENT>w, h = container.size<EOL>H = w * box_aspect/fig_aspect<EOL>if H <= h:<EOL><INDENT>W = w<EOL><DEDENT>else:<EOL><INDENT>W = h * fig_aspect/box_aspect<EOL>H = h<EOL><DEDENT>return Bbox([self._points[<NUM_LIT:0>],<EOL>self._points[<NUM_LIT:0>] + (W, H)])<EOL>

Return a copy of the :class:`Bbox`, shrunk so that it is as
large as it can be while having the desired aspect ratio,
*box_aspect*.  If the box coordinates are relative---that
is, fractions of a larger box such as a figure---then the
physical aspect ratio of that figure is specified with
*fig_aspect*, so that *box_aspect* can also be given as a
ratio of the absolute dimensions, not the relative dimensions.


return list(self.get_points().flatten()) == [<NUM_LIT:0.>, <NUM_LIT:0.>, <NUM_LIT:1.>, <NUM_LIT:1.>]<EOL>

Returns True if the :class:`Bbox` is the unit bounding box
from (0, 0) to (1, 1).


self._mtx = mtx<EOL>self.invalidate()<EOL>

Set the underlying transformation matrix from a 3x3 numpy array::

  a c e
  b d f
  0 0 1


return Bbox(self._points + (tx, ty))<EOL>

Return a copy of the :class:`Bbox`, statically translated by
*tx* and *ty*.


self._revalidate()<EOL>return self._transformed_points, self.get_affine()<EOL>

Return a copy of the child path, with the non-affine part of
the transform already applied, along with the affine part of
the path necessary to complete the transformation.  Unlike
:meth:`get_transformed_path_and_affine`, no interpolation will
be performed.


assert boxout.is_bbox<EOL>Affine2DBase.__init__(self)<EOL>self._boxout = boxout<EOL>self.set_children(boxout)<EOL>self._mtx = None<EOL>self._inverted = None<EOL>

Create a new :class:`BboxTransformTo` that linearly transforms
points from the unit bounding box to *boxout*.


return Path(self.transform_non_affine(path.vertices), path.codes)<EOL>

Returns a copy of path, transformed only by the non-affine
part of this transform.

*path*: a :class:`~matplotlib.path.Path` instance.

``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.


assert isinstance(other, Affine2DBase)<EOL>self._mtx = other.get_matrix()<EOL>self.invalidate()<EOL>

Set this transformation from the frozen copy of another
:class:`Affine2DBase` object.


raise NotImplementedError()<EOL>

Performs the transformation on the given array of values.

Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).


return self.containsx(x) and self.containsy(y)<EOL>

Returns *True* if (*x*, *y*) is a coordinate inside the
bounding box or on its edge.


w, h = self.size<EOL>return Bbox([self._points[<NUM_LIT:0>],<EOL>self._points[<NUM_LIT:0>] + [mx * w, my * h]])<EOL>

Return a copy of the :class:`Bbox`, shrunk by the factor *mx*
in the *x* direction and the factor *my* in the *y* direction.
The lower left corner of the box remains unchanged.  Normally
*mx* and *my* will be less than 1, but this is not enforced.


if np.any(self._points != points):<EOL><INDENT>self._points = points<EOL>self.invalidate()<EOL><DEDENT>

Set the points of the bounding box directly from a numpy array
of the form: [[x0, y0], [x1, y1]].  No error checking is
performed, as this method is mainly for internal use.


if np.any(self._points != other.get_points()):<EOL><INDENT>self._points = other.get_points()<EOL>self.invalidate()<EOL><DEDENT>

Set this bounding box from the "frozen" bounds of another
:class:`Bbox`.


assert isinstance(transform, Transform)<EOL>TransformNode.__init__(self)<EOL>self._path = path<EOL>self._transform = transform<EOL>self.set_children(transform)<EOL>self._transformed_path = None<EOL>self._transformed_points = None<EOL>

Create a new :class:`TransformedPath` from the given
:class:`~matplotlib.path.Path` and :class:`Transform`.


return IdentityTransform()<EOL>


return Bbox(transform.inverted().transform(self.get_points()))<EOL>

Return a new :class:`Bbox` object, statically transformed by
the inverse of the given transform.


self._invalid = <NUM_LIT:0><EOL>return self._mtx<EOL>

Get the underlying transformation matrix as a 3x3 numpy array::

  a c e
  b d f
  0 0 1


def update_from_path(self, path, ignore=None, updatex=True, updatey=True):

if ignore is None:<EOL><INDENT>ignore = self._ignore<EOL><DEDENT>if path.vertices.size == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>points, minpos, changed = update_path_extents(<EOL>path, None, self._points, self._minpos, ignore)<EOL>if changed:<EOL><INDENT>self.invalidate()<EOL>if updatex:<EOL><INDENT>self._points[:,<NUM_LIT:0>] = points[:,<NUM_LIT:0>]<EOL>self._minpos[<NUM_LIT:0>] = minpos[<NUM_LIT:0>]<EOL><DEDENT>if updatey:<EOL><INDENT>self._points[:,<NUM_LIT:1>] = points[:,<NUM_LIT:1>]<EOL>self._minpos[<NUM_LIT:1>] = minpos[<NUM_LIT:1>]<EOL><DEDENT><DEDENT>

Update the bounds of the :class:`Bbox` based on the passed in
data.  After updating, the bounds will have positive *width*
and *height*; *x0* and *y0* will be the minimal values.

*path*: a :class:`~matplotlib.path.Path` instance

*ignore*:
   - when True, ignore the existing bounds of the :class:`Bbox`.
   - when False, include the existing bounds of the :class:`Bbox`.
   - when None, use the last value passed to :meth:`ignore`.

*updatex*: when True, update the x values

*updatey*: when True, update the y values


def update_from_data_xy(self, xy, ignore=None, updatex=True, updatey=True):

if len(xy) == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>path = Path(xy)<EOL>self.update_from_path(path, ignore=ignore,<EOL>updatex=updatex, updatey=updatey)<EOL>

Update the bounds of the :class:`Bbox` based on the passed in
data.  After updating, the bounds will have positive *width*
and *height*; *x0* and *y0* will be the minimal values.

*xy*: a numpy array of 2D points

*ignore*:
   - when True, ignore the existing bounds of the :class:`Bbox`.
   - when False, include the existing bounds of the :class:`Bbox`.
   - when None, use the last value passed to :meth:`ignore`.

*updatex*: when True, update the x values

*updatey*: when True, update the y values


self._ignore = value<EOL>

Set whether the existing bounds of the box should be ignored
by subsequent calls to :meth:`update_from_data` or
:meth:`update_from_data_xy`.

*value*:

   - When True, subsequent calls to :meth:`update_from_data`
     will ignore the existing bounds of the :class:`Bbox`.

   - When False, subsequent calls to :meth:`update_from_data`
     will include the existing bounds of the :class:`Bbox`.


<EOL>value = (self.is_affine) and self.INVALID_AFFINE or self.INVALID<EOL>if self._invalid == value:<EOL><INDENT>return<EOL><DEDENT>if not len(self._parents):<EOL><INDENT>self._invalid = value<EOL>return<EOL><DEDENT>stack = [self]<EOL>while len(stack):<EOL><INDENT>root = stack.pop()<EOL>if root._invalid != value or root.pass_through:<EOL><INDENT>root._invalid = self.INVALID<EOL>stack.extend(list(root._parents.keys()))<EOL><DEDENT><DEDENT>

Invalidate this :class:`TransformNode` and all of its
ancestors.  Should be called any time the transform changes.


Affine2DBase.__init__(self)<EOL>if matrix is None:<EOL><INDENT>matrix = np.identity(<NUM_LIT:3>)<EOL><DEDENT>elif DEBUG:<EOL><INDENT>matrix = np.asarray(matrix, np.float_)<EOL>assert matrix.shape == (<NUM_LIT:3>, <NUM_LIT:3>)<EOL><DEDENT>self._mtx = matrix<EOL>self._invalid = <NUM_LIT:0><EOL>

Initialize an Affine transform from a 3x3 numpy float array::

  a c e
  b d f
  0 0 1

If *matrix* is None, initialize with the identity transform.


def __init__(self, x_transform, y_transform):

<EOL>Transform.__init__(self)<EOL>self._x = x_transform<EOL>self._y = y_transform<EOL>self.set_children(x_transform, y_transform)<EOL>self._affine = None<EOL>

Create a new "blended" transform using *x_transform* to
transform the *x*-axis and *y_transform* to transform the
*y*-axis.

You will generally not call this constructor directly but use
the :func:`blended_transform_factory` function instead, which
can determine automatically which kind of blended transform to
create.


def anchored(self, c, container = None):

if container is None:<EOL><INDENT>container = self<EOL><DEDENT>l, b, w, h = container.bounds<EOL>if isinstance(c, str):<EOL><INDENT>cx, cy = self.coefs[c]<EOL><DEDENT>else:<EOL><INDENT>cx, cy = c<EOL><DEDENT>L, B, W, H = self.bounds<EOL>return Bbox(self._points +<EOL>[(l + cx * (w-W)) - L,<EOL>(b + cy * (h-H)) - B])<EOL>

Return a copy of the :class:`Bbox`, shifted to position *c*
within a container.

*c*: may be either:

  * a sequence (*cx*, *cy*) where *cx* and *cy* range from 0
    to 1, where 0 is left or bottom and 1 is right or top

  * a string:
    - 'C' for centered
    - 'S' for bottom-center
    - 'SE' for bottom-left
    - 'E' for left
    - etc.

Optional argument *container* is the box within which the
:class:`Bbox` is positioned; it defaults to the initial
:class:`Bbox`.


assert bbox.is_bbox<EOL>assert isinstance(transform, Transform)<EOL>assert transform.input_dims == <NUM_LIT:2><EOL>assert transform.output_dims == <NUM_LIT:2><EOL>BboxBase.__init__(self)<EOL>self._bbox = bbox<EOL>self._transform = transform<EOL>self.set_children(bbox, transform)<EOL>self._points = None<EOL>

*bbox*: a child :class:`Bbox`

*transform*: a 2D :class:`Transform`


assert len(point) == self.input_dims<EOL>return self.transform(np.asarray([point]))[<NUM_LIT:0>]<EOL>

A convenience function that returns the transformed copy of a
single point.

The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.


if isinstance(other, Transform):<EOL><INDENT>return composite_transform_factory(self, other)<EOL><DEDENT>raise TypeError(<EOL>"<STR_LIT>" % type(other))<EOL>

Composes two transforms together such that *self* is followed
by *other*.


return self.fully_containsx(x)and self.fully_containsy(y)<EOL>

Returns True if (*x*, *y*) is a coordinate inside the bounding
box, but not on its edge.


points = np.array(args, dtype=np.float_).reshape(<NUM_LIT:2>, <NUM_LIT:2>)<EOL>return Bbox(points)<EOL>

(staticmethod) Create a new Bbox from *left*, *bottom*,
*right* and *top*.

The *y*-axis increases upwards.


return path<EOL>

Returns a copy of path, transformed only by the affine part of
this transform.

*path*: a :class:`~matplotlib.path.Path` instance.

``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.


a = np.cos(theta)<EOL>b = np.sin(theta)<EOL>rotate_mtx = np.array(<EOL>[[a, -b, <NUM_LIT:0.0>], [b, a, <NUM_LIT:0.0>], [<NUM_LIT:0.0>, <NUM_LIT:0.0>, <NUM_LIT:1.0>]],<EOL>np.float_)<EOL>self._mtx = np.dot(rotate_mtx, self._mtx)<EOL>self.invalidate()<EOL>return self<EOL>

Add a rotation (in radians) to this transform in place.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.


return Affine2D(np.identity(<NUM_LIT:3>))<EOL>

(staticmethod) Return a new :class:`Affine2D` object that is
the identity transform.

Unless this transform will be mutated later on, consider using
the faster :class:`IdentityTransform` class instead.


raise NotImplementedError<EOL>

Return the :class:`~matplotlib.transforms.Transform` object
associated with this scale.


_scale_mapping[scale_class.name] = scale_class<EOL>

Register a new kind of scale.

*scale_class* must be a subclass of :class:`ScaleBase`.


if axis.axis_name == '<STR_LIT:x>':<EOL><INDENT>base = kwargs.pop('<STR_LIT>', <NUM_LIT>)<EOL>linthresh = kwargs.pop('<STR_LIT>', <NUM_LIT>)<EOL>subs = kwargs.pop('<STR_LIT>', None)<EOL><DEDENT>else:<EOL><INDENT>base = kwargs.pop('<STR_LIT>', <NUM_LIT>)<EOL>linthresh = kwargs.pop('<STR_LIT>', <NUM_LIT>)<EOL>subs = kwargs.pop('<STR_LIT>', None)<EOL><DEDENT>self._transform = self.SymmetricalLogTransform(base, linthresh)<EOL>self.base = base<EOL>self.linthresh = linthresh<EOL>self.subs = subs<EOL>

*basex*/*basey*:
   The base of the logarithm

*linthreshx*/*linthreshy*:
  The range (-*x*, *x*) within which the plot is linear (to
  avoid having the plot go to infinity around zero).

*subsx*/*subsy*:
   Where to place the subticks between each major tick.
   Should be a sequence of integers.  For example, in a log10
   scale: ``[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]``

   will place 10 logarithmically spaced minor ticks between
   each major tick.


def limit_range_for_scale(self, vmin, vmax, minpos):

return (vmin <= <NUM_LIT:0.0> and minpos or vmin,<EOL>vmax <= <NUM_LIT:0.0> and minpos or vmax)<EOL>


docs = []<EOL>for name in get_scale_names():<EOL><INDENT>scale_class = _scale_mapping[name]<EOL>docs.append("<STR_LIT>" % name)<EOL>docs.append("<STR_LIT>")<EOL>class_docs = dedent(scale_class.__init__.__doc__)<EOL>class_docs = "<STR_LIT>".join(["<STR_LIT>" %<EOL>x for x in class_docs.split("<STR_LIT:\n>")])<EOL>docs.append(class_docs)<EOL>docs.append("<STR_LIT>")<EOL><DEDENT>return "<STR_LIT:\n>".join(docs)<EOL>

Helper function for generating docstrings related to scales.


return self._transform<EOL>

Return a :class:`~matplotlib.transforms.Transform` instance
appropriate for the given logarithm base.


mask = a <= <NUM_LIT:0.0><EOL>if mask.any():<EOL><INDENT>return ma.MaskedArray(a, mask=mask)<EOL><DEDENT>return a<EOL>

Return a Numpy masked array where all non-positive values are
masked.  If there are no non-positive values, the original array
is returned.


def set_clim(self, vmin=None, vmax=None):

if (vmin is not None and vmax is None and<EOL>cbook.iterable(vmin) and len(vmin)==<NUM_LIT:2>):<EOL><INDENT>vmin, vmax = vmin<EOL><DEDENT>if vmin is not None: self.norm.vmin = vmin<EOL>if vmax is not None: self.norm.vmax = vmax<EOL>self.changed()<EOL>

set the norm limits for image scaling; if *vmin* is a length2
sequence, interpret it as ``(vmin, vmax)`` which is used to
support setp

ACCEPTS: a length 2 sequence of floats


return self.norm.vmin, self.norm.vmax<EOL>

return the min, max of the color limits for image scaling


if self._A is None:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>self.norm.autoscale(self._A)<EOL>self.changed()<EOL>

Autoscale the scalar limits on the norm instance using the
current array


if name is None: name = mpl.rcParams['<STR_LIT>']<EOL>if lut is None: lut = mpl.rcParams['<STR_LIT>']<EOL>assert(name in datad.keys())<EOL>return colors.LinearSegmentedColormap(name,  datad[name], lut)<EOL>

Get a colormap instance, defaulting to rc values if *name* is None


self.callbacksSM.process('<STR_LIT>', self)<EOL>for key in self.update_dict:<EOL><INDENT>self.update_dict[key] = True<EOL><DEDENT>

Call this whenever the mappable is changed to notify all the
callbackSM listeners to the 'changed' signal


def to_rgba(self, x, alpha=<NUM_LIT:1.0>, bytes=False):

try:<EOL><INDENT>if x.ndim == <NUM_LIT:3>:<EOL><INDENT>if x.shape[<NUM_LIT:2>] == <NUM_LIT:3>:<EOL><INDENT>if x.dtype == np.uint8:<EOL><INDENT>alpha = np.array(alpha*<NUM_LIT:255>, np.uint8)<EOL><DEDENT>m, n = x.shape[:<NUM_LIT:2>]<EOL>xx = np.empty(shape=(m,n,<NUM_LIT:4>), dtype = x.dtype)<EOL>xx[:,:,:<NUM_LIT:3>] = x<EOL>xx[:,:,<NUM_LIT:3>] = alpha<EOL><DEDENT>elif x.shape[<NUM_LIT:2>] == <NUM_LIT:4>:<EOL><INDENT>xx = x<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if bytes and xx.dtype != np.uint8:<EOL><INDENT>xx = (xx * <NUM_LIT:255>).astype(np.uint8)<EOL><DEDENT>return xx<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>x = ma.asarray(x)<EOL>x = self.norm(x)<EOL>x = self.cmap(x, alpha=alpha, bytes=bytes)<EOL>return x<EOL>

Return a normalized rgba array corresponding to *x*. If *x*
        is already an rgb array, insert *alpha*; if it is already
        rgba, return it unchanged. If *bytes* is True, return rgba as
        4 uint8s instead of 4 floats.


return self.cmap<EOL>


self._A = A<EOL>self.update_dict['<STR_LIT>'] = True<EOL>

Set the image array from numpy array *A*


if norm is None: norm = colors.Normalize()<EOL>self.norm = norm<EOL>self.changed()<EOL>


if self._A is None:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>self.norm.autoscale_None(self._A)<EOL>self.changed()<EOL>

Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None


return self._A<EOL>


if tz is None: tz = _get_rc_timezone()<EOL>self.tz = tz<EOL>


return <NUM_LIT:1.>/(<NUM_LIT>*<NUM_LIT>*<NUM_LIT>)<EOL>

Return how many days a unit of the locator is; used for
intelligent autoscaling.


if unit=='<STR_LIT:date>':<EOL><INDENT>majloc = AutoDateLocator()<EOL>majfmt = AutoDateFormatter(majloc)<EOL>return units.AxisInfo(<EOL>majloc = majloc,<EOL>majfmt = majfmt,<EOL>label='<STR_LIT>',<EOL>)<EOL><DEDENT>else: return None<EOL>


def __init__(self,  byhour=None, interval=<NUM_LIT:1>, tz=None):

if byhour is None: byhour=list(range(<NUM_LIT>))<EOL>rule = rrulewrapper(HOURLY, byhour=byhour, interval=interval,<EOL>byminute=<NUM_LIT:0>, bysecond=<NUM_LIT:0>)<EOL>RRuleLocator.__init__(self, rule, tz)<EOL>

Mark every hour in *byhour*; *byhour* can be an int or sequence.
Default is to tick every hour: ``byhour=range(24)``

*interval* is the interval between each iteration.  For
example, if ``interval=2``, mark every second occurrence.


dmin, dmax = self.viewlim_to_dt()<EOL>self._locator = self.get_locator(dmin, dmax)<EOL>

Refresh internal information based on current limits.


if hasattr(dt, '<STR_LIT>') and dt.tzinfo is not None:<EOL><INDENT>delta = dt.tzinfo.utcoffset(dt)<EOL>if delta is not None:<EOL><INDENT>dt -= delta<EOL><DEDENT><DEDENT>base =  float(dt.toordinal())<EOL>if hasattr(dt, '<STR_LIT>'):<EOL><INDENT>base += (dt.hour/HOURS_PER_DAY + dt.minute/MINUTES_PER_DAY +<EOL>dt.second/SECONDS_PER_DAY + dt.microsecond/MUSECONDS_PER_DAY<EOL>)<EOL><DEDENT>return base<EOL>

Convert :mod:`datetime` to the Gregorian date as UTC float days,
preserving hours, minutes, seconds and microseconds.  Return value
is a :func:`float`.


return <NUM_LIT:1.>/(<NUM_LIT>*<NUM_LIT>)<EOL>


return h/<NUM_LIT><EOL>


def __init__(self,  byweekday=<NUM_LIT:1>, interval=<NUM_LIT:1>, tz=None):

o = rrulewrapper(DAILY, byweekday=byweekday,<EOL>interval=interval, **self.hms0d)<EOL>RRuleLocator.__init__(self, o, tz)<EOL>

Mark every weekday in *byweekday*; *byweekday* can be a number or
sequence.

Elements of *byweekday* must be one of MO, TU, WE, TH, FR, SA,
SU, the constants from :mod:`dateutils.rrule`.

*interval* specifies the number of weeks to skip.  For example,
``interval=2`` plots every second week.


def __init__(self, base=<NUM_LIT:1>, month=<NUM_LIT:1>, day=<NUM_LIT:1>, tz=None):

DateLocator.__init__(self, tz)<EOL>self.base = ticker.Base(base)<EOL>self.replaced = { '<STR_LIT>'  : month,<EOL>'<STR_LIT>'    : day,<EOL>'<STR_LIT>'   : <NUM_LIT:0>,<EOL>'<STR_LIT>' : <NUM_LIT:0>,<EOL>'<STR_LIT>' : <NUM_LIT:0>,<EOL>'<STR_LIT>' : tz<EOL>}<EOL>

Mark years that are multiple of base on a given month and day
(default jan 1).


def __init__(self,  bymonthday=None, interval=<NUM_LIT:1>, tz=None):

if bymonthday is None: bymonthday=list(range(<NUM_LIT:1>,<NUM_LIT:32>))<EOL>o = rrulewrapper(DAILY, bymonthday=bymonthday,<EOL>interval=interval, **self.hms0d)<EOL>RRuleLocator.__init__(self, o, tz)<EOL>

Mark every day in *bymonthday*; *bymonthday* can be an int or
sequence.

Default is to tick every day of the month: ``bymonthday=range(1,32)``


return float(m)/MINUTES_PER_DAY<EOL>


if cbook.iterable(n): n = np.asarray(n)<EOL>return n - <NUM_LIT><EOL>

Convert a matplotlib date (or sequence) to a Julian date (or sequence).


if tz is None: tz = _get_rc_timezone()<EOL>self.t = t<EOL>self.fmt = fmt<EOL>self.tz = tz<EOL>

*t* is a sequence of dates (floating point days).  *fmt* is a
:func:`strftime` format string.


def __init__(self,  byminute=None, interval=<NUM_LIT:1>, tz=None):

if byminute is None: byminute=list(range(<NUM_LIT>))<EOL>rule = rrulewrapper(MINUTELY, byminute=byminute, interval=interval,<EOL>bysecond=<NUM_LIT:0>)<EOL>RRuleLocator.__init__(self, rule, tz)<EOL>

Mark every minute in *byminute*; *byminute* can be an int or
sequence.  Default is to tick every minute: ``byminute=range(60)``

*interval* is the interval between each iteration.  For
example, if ``interval=2``, mark every second occurrence.


return <NUM_LIT:1><EOL>


if tz is None: tz = _get_rc_timezone()<EOL>self.fmt = fmt<EOL>self.tz = tz<EOL>

*fmt* is an :func:`strftime` format string; *tz* is the
 :class:`tzinfo` instance.


self.refresh()<EOL>return self._locator()<EOL>


return <NUM_LIT:7><EOL>

return how many days a unit of the locator is; used for
intelligent autoscaling.


dmin, dmax = self.datalim_to_dt()<EOL>ymin = self.base.le(dmin.year)<EOL>ymax = self.base.ge(dmax.year)<EOL>vmin = dmin.replace(year=ymin, **self.replaced)<EOL>vmax = dmax.replace(year=ymax, **self.replaced)<EOL>vmin = date2num(vmin)<EOL>vmax = date2num(vmax)<EOL>return self.nonsingular(vmin, vmax)<EOL>

Set the view limits to include the data range.


return w*<NUM_LIT><EOL>


return date2num(datetime.datetime(*time.strptime(s, self.fmt)[:<NUM_LIT:6>]))<EOL>

s : string to be converted
           return value: a date2num float


ind = int(round(x))<EOL>if ind>=len(self.t) or ind<=<NUM_LIT:0>: return '<STR_LIT>'<EOL>dt = num2date(self.t[ind], self.tz)<EOL>return cbook.unicode_safe(dt.strftime(self.fmt))<EOL>

Return the label for time *x* at position *pos*


return self._fontproperties<EOL>

Return the :class:`~font_manager.FontProperties` object


return self._dashpad<EOL>

Get the extra spacing between the dash and the text, in canvas units.


self._x = x<EOL>

Set the *x* position of the text

ACCEPTS: float


return self.set_stretch(stretch)<EOL>


<EOL>try:<EOL><INDENT>hash(color)<EOL><DEDENT>except TypeError:<EOL><INDENT>color = tuple(color)<EOL><DEDENT>self._color = color<EOL>

Set the foreground color of the text

ACCEPTS: any matplotlib color


self.update_coords(renderer)<EOL>if self.get_dashlength() == <NUM_LIT:0.0>:<EOL><INDENT>return Text.get_window_extent(self, renderer=renderer)<EOL><DEDENT>else:<EOL><INDENT>return self._twd_window_extent<EOL><DEDENT>

Return a :class:`~matplotlib.transforms.Bbox` object bounding
the text, in display units.

In addition to being used internally, this is useful for
specifying clickable regions in a png file on a web page.

*renderer* defaults to the _renderer attribute of the text
object.  This is not assigned until the first execution of
:meth:`draw`, so you must use this kwarg if you want
to call :meth:`get_window_extent` prior to the first
:meth:`draw`.  For getting web page regions, it is
simpler to call the method after saving the figure.


return self._dashlength<EOL>


Text.set_figure(self, fig)<EOL>self.dashline.set_figure(fig)<EOL>

Set the figure instance the artist belong to.

ACCEPTS: a :class:`matplotlib.figure.Figure` instance


return self.get_style()<EOL>


return self._fontproperties.get_stretch()<EOL>

Get the font stretch as a string or number


self._linespacing = spacing<EOL>

Set the line spacing as a multiple of the font size.
Default is 1.2.

ACCEPTS: float (multiple of font size)


if self._bbox is None:<EOL><INDENT>self._bbox = dict(facecolor=color, edgecolor=color)<EOL><DEDENT>else:<EOL><INDENT>self._bbox.update(dict(facecolor=color))<EOL><DEDENT>

Set the background color of the text by updating the bbox.

.. seealso::
    :meth:`set_bbox`

ACCEPTS: any matplotlib color


<EOL>if rectprops is not None and "<STR_LIT>" in rectprops:<EOL><INDENT>props = rectprops.copy()<EOL>boxstyle = props.pop("<STR_LIT>")<EOL>bbox_transmuter = props.pop("<STR_LIT>", None)<EOL>self._bbox_patch = FancyBboxPatch((<NUM_LIT:0.>, <NUM_LIT:0.>),<EOL><NUM_LIT:1.>, <NUM_LIT:1.>,<EOL>boxstyle=boxstyle,<EOL>bbox_transmuter=bbox_transmuter,<EOL>transform=mtransforms.IdentityTransform(),<EOL>**props)<EOL>self._bbox = None<EOL><DEDENT>else:<EOL><INDENT>self._bbox_patch = None<EOL>self._bbox = rectprops<EOL><DEDENT>

Draw a bounding box around self.  rectprops are any settable
properties for a rectangle, eg facecolor='red', alpha=0.5.

  t.set_bbox(dict(facecolor='red', alpha=0.5))

If rectprops has "boxstyle" key. A FancyBboxPatch
is initialized with rectprops and will be drawn. The mutation
scale of the FancyBboxPath is set to the fontsize.

ACCEPTS: rectangle prop dict


legal = ('<STR_LIT>', '<STR_LIT:right>', '<STR_LIT:left>')<EOL>if align not in legal:<EOL><INDENT>raise ValueError('<STR_LIT>' % str(legal))<EOL><DEDENT>self._multialignment = align<EOL>

Set the alignment for multiple lines layout.  The layout of the
bounding box of all the lines is determined bu the horizontalalignment
and verticalalignment properties, but the multiline text within that
box can be

ACCEPTS: ['left' | 'right' | 'center' ]


Artist.update_from(self, other)<EOL>self._color = other._color<EOL>self._multialignment = other._multialignment<EOL>self._verticalalignment = other._verticalalignment<EOL>self._horizontalalignment = other._horizontalalignment<EOL>self._fontproperties = other._fontproperties.copy()<EOL>self._rotation = other._rotation<EOL>self._picker = other._picker<EOL>self._linespacing = other._linespacing<EOL>


x, y = self.get_position()<EOL>return self.get_transform().transform_point((x,y))<EOL>

get the (possibly unit converted) transformed x, y in display coords


return self.set_size(fontsize)<EOL>


self._rotation = s<EOL>

Set the rotation of the text

ACCEPTS: [ angle in degrees | 'vertical' | 'horizontal' ]


self._fontproperties.set_weight(weight)<EOL>

Set the font weight.

ACCEPTS: [ a numeric value in range 0-1000 | 'ultralight' | 'light' | 'normal' | 'regular' | 'book' | 'medium' | 'roman' | 'semibold' | 'demibold' | 'demi' | 'bold' | 'heavy' | 'extra bold' | 'black' ]


return self.get_weight()<EOL>


if rotation in ('<STR_LIT>', None):<EOL><INDENT>angle = <NUM_LIT:0.><EOL><DEDENT>elif rotation == '<STR_LIT>':<EOL><INDENT>angle = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>angle = float(rotation)<EOL><DEDENT>return angle%<NUM_LIT><EOL>

Return the text angle as float.

*rotation* may be 'horizontal', 'vertical', or a numeric value in degrees.


self._fontproperties.set_size(fontsize)<EOL>

Set the font size.  May be either a size string, relative to
the default font size, or an absolute font size in points.

ACCEPTS: [ size in points | 'xx-small' | 'x-small' | 'small' | 'medium' | 'large' | 'x-large' | 'xx-large' ]


return self.get_family()<EOL>


return self._text<EOL>


self._dashy = float(y)<EOL>

Set the *y* position of the :class:`TextWithDash`.

ACCEPTS: float


return self._dashpush<EOL>

Get the extra spacing between the dash and the specified text
position, in canvas units.


return self.set_weight(weight)<EOL>


self._y = y<EOL>

Set the *y* position of the text

ACCEPTS: float


return self._fontproperties.get_variant()<EOL>


return self.get_name()<EOL>


if renderer is not None:<EOL><INDENT>self._renderer = renderer<EOL><DEDENT>if not self.get_visible(): return<EOL>if self._text=='<STR_LIT>': return<EOL>bbox, info = self._get_layout(renderer)<EOL>trans = self.get_transform()<EOL>posx = float(self.convert_xunits(self._x))<EOL>posy = float(self.convert_yunits(self._y))<EOL>posx, posy = trans.transform_point((posx, posy))<EOL>canvasw, canvash = renderer.get_canvas_width_height()<EOL>if self._bbox_patch:<EOL><INDENT>self._draw_bbox(renderer, posx, posy)<EOL><DEDENT>gc = renderer.new_gc()<EOL>gc.set_foreground(self._color)<EOL>gc.set_alpha(self._alpha)<EOL>gc.set_url(self._url)<EOL>if self.get_clip_on():<EOL><INDENT>gc.set_clip_rectangle(self.clipbox)<EOL><DEDENT>if self._bbox:<EOL><INDENT>bbox_artist(self, renderer, self._bbox)<EOL><DEDENT>angle = self.get_rotation()<EOL>if rcParams['<STR_LIT>']:<EOL><INDENT>for line, wh, x, y in info:<EOL><INDENT>x = x + posx<EOL>y = y + posy<EOL>if renderer.flipy():<EOL><INDENT>y = canvash-y<EOL><DEDENT>clean_line, ismath = self.is_math_text(line)<EOL>renderer.draw_tex(gc, x, y, clean_line,<EOL>self._fontproperties, angle)<EOL><DEDENT>return<EOL><DEDENT>for line, wh, x, y in info:<EOL><INDENT>x = x + posx<EOL>y = y + posy<EOL>if renderer.flipy():<EOL><INDENT>y = canvash-y<EOL><DEDENT>clean_line, ismath = self.is_math_text(line)<EOL>renderer.draw_text(gc, x, y, clean_line,<EOL>self._fontproperties, angle,<EOL>ismath=ismath)<EOL><DEDENT>

Draws the :class:`Text` object to the given *renderer*.


def get_window_extent(self, renderer=None, dpi=None):

<EOL>if not self.get_visible(): return Bbox.unit()<EOL>if dpi is not None:<EOL><INDENT>dpi_orig = self.figure.dpi<EOL>self.figure.dpi = dpi<EOL><DEDENT>if self._text == '<STR_LIT>':<EOL><INDENT>tx, ty = self._get_xy_display()<EOL>return Bbox.from_bounds(tx,ty,<NUM_LIT:0>,<NUM_LIT:0>)<EOL><DEDENT>if renderer is not None:<EOL><INDENT>self._renderer = renderer<EOL><DEDENT>if self._renderer is None:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>bbox, info = self._get_layout(self._renderer)<EOL>x, y = self.get_position()<EOL>x, y = self.get_transform().transform_point((x, y))<EOL>bbox = bbox.translated(x, y)<EOL>if dpi is not None:<EOL><INDENT>self.figure.dpi = dpi_orig<EOL><DEDENT>return bbox<EOL>

Return a :class:`~matplotlib.transforms.Bbox` object bounding
the text, in display units.

In addition to being used internally, this is useful for
specifying clickable regions in a png file on a web page.

*renderer* defaults to the _renderer attribute of the text
object.  This is not assigned until the first execution of
:meth:`draw`, so you must use this kwarg if you want
to call :meth:`get_window_extent` prior to the first
:meth:`draw`.  For getting web page regions, it is
simpler to call the method after saving the figure.

*dpi* defaults to self.figure.dpi; the renderer dpi is
irrelevant.  For the web application, if figure.dpi is not
the value used when saving the figure, then the value that
was used must be specified as the *dpi* argument.


x = float(self.convert_xunits(self._dashx))<EOL>y = float(self.convert_yunits(self._dashy))<EOL>return x, y<EOL>

Return the position of the text as a tuple (*x*, *y*)


self._dashpush = dp<EOL>

Set the "push" of the TextWithDash, which
is the extra spacing between the beginning
of the dash and the specified position.

ACCEPTS: float (canvas units)


return self._header['<STR_LIT>']<EOL>


(dhead, dcmetrics_ascii, dcmetrics_name, dkernpairs, dcomposite) =parse_afm(fh)<EOL>self._header = dhead<EOL>self._kern = dkernpairs<EOL>self._metrics = dcmetrics_ascii<EOL>self._metrics_by_name = dcmetrics_name<EOL>self._composite = dcomposite<EOL>


def get_name_char(self, c, isord=False):

if not isord: c=ord(c)<EOL>wx, name, bbox = self._metrics[c]<EOL>return name<EOL>

Get the name of the character, ie, ';' is 'semicolon'


name = self._header.get('<STR_LIT>')<EOL>if name is None: <EOL><INDENT>name = self._header['<STR_LIT>']<EOL><DEDENT>return name<EOL>

Return the font full name, eg, 'Times-Roman


return self.get_str_bbox_and_descent(s)[:<NUM_LIT:4>]<EOL>


line = fh.readline()<EOL>if not line.startswith('<STR_LIT>'):<EOL><INDENT>raise RuntimeError('<STR_LIT>'%line)<EOL><DEDENT>d = {}<EOL>while <NUM_LIT:1>:<EOL><INDENT>line = fh.readline()<EOL>if not line: break<EOL>line = line.rstrip()<EOL>if len(line)==<NUM_LIT:0>: continue<EOL>if line.startswith('<STR_LIT>'):<EOL><INDENT>fh.readline()  <EOL>return d<EOL><DEDENT>vals = line.split()<EOL>if len(vals)!=<NUM_LIT:4> or vals[<NUM_LIT:0>]!='<STR_LIT>':<EOL><INDENT>raise RuntimeError('<STR_LIT>'%line)<EOL><DEDENT>c1, c2, val = vals[<NUM_LIT:1>], vals[<NUM_LIT:2>], _to_float(vals[<NUM_LIT:3>])<EOL>d[(c1,c2)] = val<EOL><DEDENT>raise RuntimeError('<STR_LIT>')<EOL>

Return a kern pairs dictionary; keys are (*char1*, *char2*) tuples and
values are the kern pair value.  For example, a kern pairs line like
``KPX A y -50``

will be represented as::

  d[ ('A', 'y') ] = -50


return self._header.get('<STR_LIT>', None)<EOL>

Return the standard vertical stem width as float, or *None* if
not specified in AFM file.


name = self._header.get('<STR_LIT>')<EOL>if name is not None:<EOL><INDENT>return name<EOL><DEDENT>name = self.get_fullname()<EOL>extras = r'<STR_LIT>'<EOL>return re.sub(extras, '<STR_LIT>', name)<EOL>


<EOL>pos = fh.tell()<EOL>try:<EOL><INDENT>line = fh.readline()<EOL><DEDENT>finally:<EOL><INDENT>fh.seek(pos, <NUM_LIT:0>)<EOL><DEDENT>if not line.startswith('<STR_LIT>'):<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>

Check if the file at least looks like AFM.
If not, raise :exc:`RuntimeError`.


def get_width_char(self, c, isord=False):

if not isord: c=ord(c)<EOL>wx, name, bbox = self._metrics[c]<EOL>return wx<EOL>

Get the width of the character from the character metric WX
field


wx, bbox = self._metrics_by_name[name]<EOL>return wx<EOL>

Get the width of the character from a type1 character name


if not len(s): return <NUM_LIT:0>,<NUM_LIT:0><EOL>totalw = <NUM_LIT:0><EOL>namelast = None<EOL>miny = <NUM_LIT><EOL>maxy = <NUM_LIT:0><EOL>for c in s:<EOL><INDENT>if c == '<STR_LIT:\n>': continue<EOL>wx, name, bbox = self._metrics[ord(c)]<EOL>l,b,w,h = bbox<EOL>try: kp = self._kern[ (namelast, name) ]<EOL>except KeyError: kp = <NUM_LIT:0><EOL>totalw += wx + kp<EOL>thismax = b+h<EOL>if thismax>maxy: maxy = thismax<EOL>thismin = b<EOL>if thismin<miny: miny = thismin<EOL><DEDENT>return totalw, maxy-miny<EOL>

Return the string width (including kerning) and string height
as a (*w*, *h*) tuple.


optional = {<EOL>'<STR_LIT>' : _parse_kern_pairs,<EOL>'<STR_LIT>' :  _parse_composites,<EOL>}<EOL>d = {'<STR_LIT>':{}, '<STR_LIT>':{}}<EOL>while <NUM_LIT:1>:<EOL><INDENT>line = fh.readline()<EOL>if not line: break<EOL>line = line.rstrip()<EOL>if len(line)==<NUM_LIT:0>: continue<EOL>key = line.split()[<NUM_LIT:0>]<EOL>if key in optional: d[key] = optional[key](fh)<EOL><DEDENT>l = ( d['<STR_LIT>'], d['<STR_LIT>'] )<EOL>return l<EOL>

Parse the optional fields for kern pair data and composites

return value is a (*kernDict*, *compositeDict*) which are the
return values from :func:`_parse_kern_pairs`, and
:func:`_parse_composites` if the data exists, or empty dicts
otherwise


def find_nearest_contour( self, x, y, indices=None, pixel=True ):

<EOL>if indices==None:<EOL><INDENT>indices = list(range(len(self.levels)))<EOL><DEDENT>dmin = <NUM_LIT><EOL>conmin = None<EOL>segmin = None<EOL>xmin = None<EOL>ymin = None<EOL>for icon in indices:<EOL><INDENT>con = self.collections[icon]<EOL>paths = con.get_paths()<EOL>for segNum, linepath in enumerate(paths):<EOL><INDENT>lc = linepath.vertices<EOL>if pixel:<EOL><INDENT>lc = self.ax.transData.transform(lc)<EOL><DEDENT>ds = (lc[:,<NUM_LIT:0>]-x)**<NUM_LIT:2> + (lc[:,<NUM_LIT:1>]-y)**<NUM_LIT:2><EOL>d = min( ds )<EOL>if d < dmin:<EOL><INDENT>dmin = d<EOL>conmin = icon<EOL>segmin = segNum<EOL>imin = mpl.mlab.find( ds == d )[<NUM_LIT:0>]<EOL>xmin = lc[imin,<NUM_LIT:0>]<EOL>ymin = lc[imin,<NUM_LIT:1>]<EOL><DEDENT><DEDENT><DEDENT>return (conmin,segmin,imin,xmin,ymin,dmin)<EOL>

Finds contour that is closest to a point.  Defaults to
measuring distance in pixels (screen space - useful for manual
contour labeling), but this can be controlled via a keyword
argument.

Returns a tuple containing the contour, segment, index of
segment, x & y of segment point and distance to minimum point.

Call signature::

  conmin,segmin,imin,xmin,ymin,dmin = find_nearest_contour(
             self, x, y, indices=None, pixel=True )

Optional keyword arguments::

*indices*:
   Indexes of contour levels to consider when looking for
   nearest point.  Defaults to using all levels.

*pixel*:
   If *True*, measure distance in pixel space, if not, measure
   distance in axes space.  Defaults to *True*.


if cbook.is_string_like(lev):<EOL><INDENT>return lev<EOL><DEDENT>else:<EOL><INDENT>if isinstance(fmt,dict):<EOL><INDENT>return fmt[lev]<EOL><DEDENT>else:<EOL><INDENT>return fmt%lev<EOL><DEDENT><DEDENT>


def get_label_width(self, lev, fmt, fsize):

if cbook.is_string_like(lev):<EOL><INDENT>lw = (len(lev)) * fsize<EOL><DEDENT>else:<EOL><INDENT>lw = (len(self.get_text(lev,fmt))) * fsize<EOL><DEDENT>return lw<EOL>


self.monochrome = self.cmap.monochrome<EOL>if self.colors is not None:<EOL><INDENT>i0, i1 = <NUM_LIT:0>, len(self.layers)<EOL>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>i0 = -<NUM_LIT:1><EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>i1 = i1 + <NUM_LIT:1><EOL><DEDENT>self.cvalues = list(range(i0, i1))<EOL>self.set_norm(colors.NoNorm())<EOL><DEDENT>else:<EOL><INDENT>self.cvalues = self.layers<EOL><DEDENT>if not self.norm.scaled():<EOL><INDENT>self.set_clim(self.vmin, self.vmax)<EOL><DEDENT>if self.extend in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>self.norm.clip = False<EOL><DEDENT>self.set_array(self.layers)<EOL>

Color argument processing for contouring.

Note that we base the color mapping on the contour levels,
not on the actual range of the Z values.  This means we
don't have to worry about bad values in Z, and we always have
the full dynamic range available for the selected levels.

The color is based on the midpoint of the layer, except for
an extended end layers.


<EOL>x = self.ax.convert_xunits( args[<NUM_LIT:0>] )<EOL>y = self.ax.convert_yunits( args[<NUM_LIT:1>] )<EOL>x = np.asarray(x, dtype=np.float64)<EOL>y = np.asarray(y, dtype=np.float64)<EOL>z = ma.asarray(args[<NUM_LIT:2>], dtype=np.float64)<EOL>if z.ndim != <NUM_LIT:2>:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>else: Ny, Nx = z.shape<EOL>if x.shape == z.shape and y.shape == z.shape:<EOL><INDENT>return x,y,z<EOL><DEDENT>if x.ndim != <NUM_LIT:1> or y.ndim != <NUM_LIT:1>:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>nx, = x.shape<EOL>ny, = y.shape<EOL>if nx != Nx or ny != Ny:<EOL><INDENT>raise TypeError("<STR_LIT>" +<EOL>"<STR_LIT>")<EOL><DEDENT>x,y = np.meshgrid(x,y)<EOL>return x,y,z<EOL>

For functions like contour, check that the dimensions
of the input arrays match; if x and y are 1D, convert
them to 2D using meshgrid.

Possible change: I think we should make and use an ArgumentError
Exception class (here and elsewhere).


self.labelCValues.pop(index)<EOL>t = self.labelTexts.pop(index)<EOL>t.remove()<EOL>

Defaults to removing last label, but any index can be supplied


lcsize = len(linecontour)<EOL>if lcsize > <NUM_LIT:10> * labelwidth:<EOL><INDENT>return <NUM_LIT:1><EOL><DEDENT>xmax = np.amax(linecontour[:,<NUM_LIT:0>])<EOL>xmin = np.amin(linecontour[:,<NUM_LIT:0>])<EOL>ymax = np.amax(linecontour[:,<NUM_LIT:1>])<EOL>ymin = np.amin(linecontour[:,<NUM_LIT:1>])<EOL>lw = labelwidth<EOL>if (xmax - xmin) > <NUM_LIT>* lw or (ymax - ymin) > <NUM_LIT> * lw:<EOL><INDENT>return <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>

if contours are too short, don't plot a label


def get_real_label_width( self, lev, fmt, fsize ):

<EOL>xx = np.mean( np.asarray(self.ax.axis()).reshape(<NUM_LIT:2>,<NUM_LIT:2>), axis=<NUM_LIT:1> )<EOL>t = text.Text( xx[<NUM_LIT:0>], xx[<NUM_LIT:1>] )<EOL>self.set_label_props( t, self.get_text(lev,fmt), '<STR_LIT:k>' )<EOL>bbox = t.get_window_extent(renderer=self.ax.figure.canvas.renderer)<EOL>lw = np.diff(bbox.corners()[<NUM_LIT:0>::<NUM_LIT:2>,<NUM_LIT:0>])[<NUM_LIT:0>]<EOL>return lw<EOL>

This computes actual onscreen label width.
This uses some black magic to determine onscreen extent of non-drawn
label.  This magic may not be very robust.


def set_label_props(self, label, text, color):

label.set_text(text)<EOL>label.set_color(color)<EOL>label.set_fontproperties(self.labelFontProps)<EOL>label.set_clip_box(self.ax.bbox)<EOL>

set the label properties - color, fontsize, text


if self.locator is None:<EOL><INDENT>if self.logscale:<EOL><INDENT>self.locator = ticker.LogLocator()<EOL><DEDENT>else:<EOL><INDENT>self.locator = ticker.MaxNLocator(N+<NUM_LIT:1>)<EOL><DEDENT><DEDENT>self.locator.create_dummy_axis()<EOL>zmax = self.zmax<EOL>zmin = self.zmin<EOL>self.locator.set_bounds(zmin, zmax)<EOL>lev = self.locator()<EOL>zmargin = (zmax - zmin) * <NUM_LIT> <EOL>if zmax >= lev[-<NUM_LIT:1>]:<EOL><INDENT>lev[-<NUM_LIT:1>] += zmargin<EOL><DEDENT>if zmin <= lev[<NUM_LIT:0>]:<EOL><INDENT>if self.logscale:<EOL><INDENT>lev[<NUM_LIT:0>] = <NUM_LIT> * zmin<EOL><DEDENT>else:<EOL><INDENT>lev[<NUM_LIT:0>] -= zmargin<EOL><DEDENT><DEDENT>self._auto = True<EOL>if self.filled:<EOL><INDENT>return lev<EOL><DEDENT>return lev[<NUM_LIT:1>:-<NUM_LIT:1>]<EOL>

Select contour levels to span the data.

We need two more levels for filled contours than for
line contours, because for the latter we need to specify
the lower and upper boundary of each range. For example,
a single contour boundary, say at z = 0, requires only
one contour line, but two filled regions, and therefore
three levels to provide boundaries for both regions.


def get_label_coords(self, distances, XX, YY, ysize, lw):

hysize = int(ysize/<NUM_LIT:2>)<EOL>adist = np.argsort(distances)<EOL>for ind in adist:<EOL><INDENT>x, y = XX[ind][hysize], YY[ind][hysize]<EOL>if self.too_close(x,y, lw):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>return x,y, ind<EOL><DEDENT><DEDENT>ind = adist[<NUM_LIT:0>]<EOL>x, y = XX[ind][hysize], YY[ind][hysize]<EOL>return x,y, ind<EOL>

labels are ploted at a location with the smallest
        dispersion of the contour from a straight line
        unless there's another label nearby, in which case
        the second best place on the contour is picked up
        if there's no good place a label isplotted at the
        beginning of the contour


return self._state_stack[-<NUM_LIT:1>]<EOL>

Get the current :class:`State` of the parser.


self.font_output.render_glyph(<EOL>x, y,<EOL>self.font, self.font_class, self.c, self.fontsize, self.dpi)<EOL>


def get_underline_thickness(self, font, fontsize, dpi):

raise NotImplementedError()<EOL>

Get the line thickness that matches the given font.  Used as a
base unit for drawing lines such as in a fraction or radical.


self.width, self.height, self.depth = ceil(w), ceil(h), ceil(d)<EOL>self.mathtext_backend.set_canvas_size(self.width, self.height, self.depth)<EOL>

Set the size of the buffer used to render the math expression.
Only really necessary for the bitmap backends.


def get_xheight(self, font, fontsize, dpi):

raise NotImplementedError()<EOL>

Get the xheight for the given *font* and *fontsize*.


def to_rgba(self, texstr, color='<STR_LIT>', dpi=<NUM_LIT>, fontsize=<NUM_LIT>):

x, depth = self.to_mask(texstr, dpi=dpi, fontsize=fontsize)<EOL>r, g, b = mcolors.colorConverter.to_rgb(color)<EOL>RGBA = np.zeros((x.shape[<NUM_LIT:0>], x.shape[<NUM_LIT:1>], <NUM_LIT:4>), dtype=np.uint8)<EOL>RGBA[:,:,<NUM_LIT:0>] = int(<NUM_LIT:255>*r)<EOL>RGBA[:,:,<NUM_LIT:1>] = int(<NUM_LIT:255>*g)<EOL>RGBA[:,:,<NUM_LIT:2>] = int(<NUM_LIT:255>*b)<EOL>RGBA[:,:,<NUM_LIT:3>] = x<EOL>return RGBA, depth<EOL>

*texstr*
    A valid mathtext string, eg r'IQ: $\sigma_i=15$'

*color*
    Any matplotlib color argument

*dpi*
    The dots-per-inch to render the text

*fontsize*
    The font size in points

Returns a tuple (*array*, *depth*)

  - *array* is an NxM uint8 alpha ubyte mask array of
    rasterized tex.

  - depth is the offset of the baseline from the bottom of the
    image in pixels.


def get_kern(self, font1, fontclass1, sym1, fontsize1,<EOL>font2, fontclass2, sym2, fontsize2, dpi):

return <NUM_LIT:0.><EOL>

Get the kerning distance for font between *sym1* and *sym2*.

*fontX*: one of the TeX font names::

  tt, it, rm, cal, sf, bf or default (non-math)

*fontclassX*: TODO

*symX*: a symbol in raw TeX form. e.g. '1', 'x' or '\sigma'

*fontsizeX*: the fontsize in points

*dpi*: the current dots-per-inch


def parse(self, s, dpi = <NUM_LIT>, prop = None):

if prop is None:<EOL><INDENT>prop = FontProperties()<EOL><DEDENT>cacheKey = (s, dpi, hash(prop))<EOL>result = self._cache.get(cacheKey)<EOL>if result is not None:<EOL><INDENT>return result<EOL><DEDENT>if self._output == '<STR_LIT>' and rcParams['<STR_LIT>']:<EOL><INDENT>font_output = StandardPsFonts(prop)<EOL><DEDENT>else:<EOL><INDENT>backend = self._backend_mapping[self._output]()<EOL>fontset = rcParams['<STR_LIT>']<EOL>fontset_class = self._font_type_mapping.get(fontset.lower())<EOL>if fontset_class is not None:<EOL><INDENT>font_output = fontset_class(prop, backend)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>fontsize = prop.get_size_in_points()<EOL>if self._parser is None:<EOL><INDENT>self.__class__._parser = Parser()<EOL><DEDENT>box = self._parser.parse(s, font_output, fontsize, dpi)<EOL>font_output.set_canvas_size(box.width, box.height, box.depth)<EOL>result = font_output.get_results(box)<EOL>self._cache[cacheKey] = result<EOL>self._parser.clear()<EOL>font_output.destroy()<EOL>font_output.mathtext_backend.fonts_object = None<EOL>font_output.mathtext_backend = None<EOL>return result<EOL>

Parse the given math expression *s* at the given *dpi*.  If
*prop* is provided, it is a
:class:`~matplotlib.font_manager.FontProperties` object
specifying the "default" font to use in the math expression,
used for all non-math text.

The results are cached, so multiple calls to :meth:`parse`
with the same expression should be fast.


self.size -= <NUM_LIT:1><EOL>

Grows one level larger.  There is no limit to how big
something can get.


return self.used_characters<EOL>

Get the set of characters that were used in the math
expression.  Used by backends that need to subset fonts so
they know which glyphs to include.


def hpack(self, w=<NUM_LIT:0.>, m='<STR_LIT>'):

<EOL>h = <NUM_LIT:0.><EOL>d = <NUM_LIT:0.><EOL>x = <NUM_LIT:0.><EOL>total_stretch = [<NUM_LIT:0.>] * <NUM_LIT:4><EOL>total_shrink = [<NUM_LIT:0.>] * <NUM_LIT:4><EOL>for p in self.children:<EOL><INDENT>if isinstance(p, Char):<EOL><INDENT>x += p.width<EOL>h = max(h, p.height)<EOL>d = max(d, p.depth)<EOL><DEDENT>elif isinstance(p, Box):<EOL><INDENT>x += p.width<EOL>if not isinf(p.height) and not isinf(p.depth):<EOL><INDENT>s = getattr(p, '<STR_LIT>', <NUM_LIT:0.>)<EOL>h = max(h, p.height - s)<EOL>d = max(d, p.depth + s)<EOL><DEDENT><DEDENT>elif isinstance(p, Glue):<EOL><INDENT>glue_spec = p.glue_spec<EOL>x += glue_spec.width<EOL>total_stretch[glue_spec.stretch_order] += glue_spec.stretch<EOL>total_shrink[glue_spec.shrink_order] += glue_spec.shrink<EOL><DEDENT>elif isinstance(p, Kern):<EOL><INDENT>x += p.width<EOL><DEDENT><DEDENT>self.height = h<EOL>self.depth = d<EOL>if m == '<STR_LIT>':<EOL><INDENT>w += x<EOL><DEDENT>self.width = w<EOL>x = w - x<EOL>if x == <NUM_LIT:0.>:<EOL><INDENT>self.glue_sign = <NUM_LIT:0><EOL>self.glue_order = <NUM_LIT:0><EOL>self.glue_ratio = <NUM_LIT:0.><EOL>return<EOL><DEDENT>if x > <NUM_LIT:0.>:<EOL><INDENT>self._set_glue(x, <NUM_LIT:1>, total_stretch, "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>self._set_glue(x, -<NUM_LIT:1>, total_shrink, "<STR_LIT>")<EOL><DEDENT>

The main duty of :meth:`hpack` is to compute the dimensions of
the resulting boxes, and to adjust the glue if one of those
dimensions is pre-specified.  The computed sizes normally
enclose all of the material inside the new box; but some items
may stick out if negative glue is used, if the box is
overfull, or if a ``\\vbox`` includes other boxes that have
been shifted left.

  - *w*: specifies a width

  - *m*: is either 'exactly' or 'additional'.

Thus, ``hpack(w, 'exactly')`` produces a box whose width is
exactly *w*, while ``hpack(w, 'additional')`` yields a box
whose width is the natural width plus *w*.  The default values
produce a box with the natural width.


raise NotImplementedError()<EOL>

Draw a glyph described by *info* to the reference point (*ox*,
*oy*).


raise NotImplementedError()<EOL>

Return a backend-specific tuple to return to the backend after
all processing is done.


def to_mask(self, texstr, dpi=<NUM_LIT>, fontsize=<NUM_LIT>):

assert(self._output=="<STR_LIT>")<EOL>prop = FontProperties(size=fontsize)<EOL>ftimage, depth = self.parse(texstr, dpi=dpi, prop=prop)<EOL>x = ftimage.as_array()<EOL>return x, depth<EOL>

*texstr*
    A valid mathtext string, eg r'IQ: $\sigma_i=15$'

*dpi*
    The dots-per-inch to render the text

*fontsize*
    The font size in points

Returns a tuple (*array*, *depth*)

  - *array* is an NxM uint8 alpha ubyte mask array of
    rasterized tex.

  - depth is the offset of the baseline from the bottom of the
    image in pixels.


self._output = output.lower()<EOL>self._cache = maxdict(<NUM_LIT:50>)<EOL>

Create a MathTextParser for the given backend *output*.


def parse(self, s, fonts_object, fontsize, dpi):

self._state_stack = [self.State(fonts_object, '<STR_LIT:default>', '<STR_LIT>', fontsize, dpi)]<EOL>try:<EOL><INDENT>self._expression.parseString(s)<EOL><DEDENT>except ParseException as err:<EOL><INDENT>raise ValueError("<STR_LIT:\n>".join([<EOL>"<STR_LIT>",<EOL>err.line,<EOL>"<STR_LIT:U+0020>" * (err.column - <NUM_LIT:1>) + "<STR_LIT>",<EOL>str(err)]))<EOL><DEDENT>return self._expr<EOL>

Parse expression *s* using the given *fonts_object* for
output, at the given *fontsize* and *dpi*.

Returns the parse tree of :class:`Node` instances.


def get_sized_alternatives_for_symbol(self, fontname, sym):

return [(fontname, sym)]<EOL>

Override if your font provides multiple sizes of the same
symbol.  Should return a list of symbols matching *sym* in
various sizes.  The expression renderer will select the most
appropriate size for a given situation from this list.


advance = self._metrics.advance - self.width<EOL>kern = <NUM_LIT:0.><EOL>if isinstance(next, Char):<EOL><INDENT>kern = self.font_output.get_kern(<EOL>self.font, self.font_class, self.c, self.fontsize,<EOL>next.font, next.font_class, next.c, next.fontsize,<EOL>self.dpi)<EOL><DEDENT>return advance + kern<EOL>

Return the amount of kerning between this and the given
character.  Called when characters are strung together into
:class:`Hlist` to create :class:`Kern` nodes.


def raise_error(s, loc, toks):<EOL><INDENT>raise ParseFatalException(msg + "<STR_LIT:\n>" + s)<EOL><DEDENT>empty = Empty()<EOL>empty.setParseAction(raise_error)<EOL>return empty<EOL>