336 lines (272 with data), 24.8 kB
@header@
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="matplotlib.html"><font color="#ffffff">matplotlib</font></a>.<a href="matplotlib.backends.html"><font color="#ffffff">backends</font></a>.backend_cairo</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/lib/python2.3/site-packages/matplotlib/backends/backend_cairo.py">/usr/local/lib/python2.3/site-packages/matplotlib/backends/backend_cairo.py</a></font></td></tr></table>
<p><tt>A Cairo backend for matplotlib<br>
Author: Steve Chaplin<br>
<br>
Cairo is a vector graphics library with cross-device output support.<br>
Features of Cairo:<br>
* anti-aliasing<br>
* alpha channel <br>
* in-memory image buffers<br>
* save image files:<br>
- PNG<br>
- PostScript (50% complete)<br>
- PDF (proposed, 0% complete)<br>
<br>
<a href="http://cairographics.org">http://cairographics.org</a><br>
Requires (in order, all available from Cairo website):<br>
libpixman, cairo, pycairo<br>
<br>
Naming Conventions<br>
* classes MixedUpperCase<br>
* varables lowerUpper<br>
* functions underscore_separated</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="cairo.html">cairo</a><br>
</td><td width="25%" valign=top><a href="matplotlib.numerix.html">matplotlib.numerix</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="matplotlib.backend_bases.html#FigureCanvasBase">matplotlib.backend_bases.FigureCanvasBase</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="matplotlib.backends.backend_cairo.html#FigureCanvasCairo">FigureCanvasCairo</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="matplotlib.backend_bases.html#GraphicsContextBase">matplotlib.backend_bases.GraphicsContextBase</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="matplotlib.backends.backend_cairo.html#GraphicsContextCairo">GraphicsContextCairo</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="matplotlib.backend_bases.html#RendererBase">matplotlib.backend_bases.RendererBase</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="matplotlib.backends.backend_cairo.html#RendererCairo">RendererCairo</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="FigureCanvasCairo">class <strong>FigureCanvasCairo</strong></a>(<a href="matplotlib.backend_bases.html#FigureCanvasBase">matplotlib.backend_bases.FigureCanvasBase</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="FigureCanvasCairo-print_figure"><strong>print_figure</strong></a>(self, filename, dpi<font color="#909090">=150</font>, facecolor<font color="#909090">='w'</font>, edgecolor<font color="#909090">='w'</font>, orientation<font color="#909090">='portrait'</font>)</dt></dl>
<hr>
Methods inherited from <a href="matplotlib.backend_bases.html#FigureCanvasBase">matplotlib.backend_bases.FigureCanvasBase</a>:<br>
<dl><dt><a name="FigureCanvasCairo-__init__"><strong>__init__</strong></a>(self, figure)</dt></dl>
<dl><dt><a name="FigureCanvasCairo-button_press_event"><strong>button_press_event</strong></a>(self, x, y, button)</dt><dd><tt>Backend derived classes should call this function on any mouse<br>
button press. x,y are the canvas coords: 0,0 is lower, left.<br>
button and key are as defined in MouseEvent</tt></dd></dl>
<dl><dt><a name="FigureCanvasCairo-button_release_event"><strong>button_release_event</strong></a>(self, x, y, button)</dt><dd><tt>Backend derived classes should call this function on any mouse<br>
button release. x,y are the canvas coords: 0,0 is lower, left.<br>
button and key are as defined in MouseEvent</tt></dd></dl>
<dl><dt><a name="FigureCanvasCairo-draw"><strong>draw</strong></a>(self)</dt><dd><tt>Render the figure</tt></dd></dl>
<dl><dt><a name="FigureCanvasCairo-key_press_event"><strong>key_press_event</strong></a>(self, key)</dt></dl>
<dl><dt><a name="FigureCanvasCairo-key_release_event"><strong>key_release_event</strong></a>(self, key)</dt></dl>
<dl><dt><a name="FigureCanvasCairo-motion_notify_event"><strong>motion_notify_event</strong></a>(self, x, y)</dt><dd><tt>Backend derived classes should call this function on any mouse<br>
button release. x,y are the canvas coords: 0,0 is lower, left.<br>
button and key are as defined in MouseEvent</tt></dd></dl>
<dl><dt><a name="FigureCanvasCairo-mpl_connect"><strong>mpl_connect</strong></a>(self, s, func)</dt><dd><tt>Connect event with string s to func. The signature of func is<br>
<br>
def func(event)<br>
<br>
where event is a MplEvent. The following events are recognized<br>
<br>
'key_press_event' <br>
'button_press_event' <br>
'button_release_event' <br>
'motion_notify_event' <br>
<br>
For the three events above, if the mouse is over the axes,<br>
the variable event.inaxes will be set to the axes it is over,<br>
and additionally, the variables event.xdata and event.ydata<br>
will be defined. This is the mouse location in data coords.<br>
See backend_bases.MplEvent.<br>
<br>
return value is a connection id that can be used with<br>
mpl_disconnect</tt></dd></dl>
<dl><dt><a name="FigureCanvasCairo-mpl_disconnect"><strong>mpl_disconnect</strong></a>(self, cid)</dt><dd><tt>Connect s to func. return an id that can be used with disconnect<br>
Method should return None</tt></dd></dl>
<dl><dt><a name="FigureCanvasCairo-switch_backends"><strong>switch_backends</strong></a>(self, FigureCanvasClass)</dt><dd><tt>instantiate an instance of FigureCanvasClass<br>
<br>
This is used for backend switching, eg, to instantiate a<br>
FigureCanvasPS from a FigureCanvasGTK. Note, deep copying is<br>
not done, so any changes to one of the instances (eg, setting<br>
figure size or line props), will be reflected in the other</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="matplotlib.backend_bases.html#FigureCanvasBase">matplotlib.backend_bases.FigureCanvasBase</a>:<br>
<dl><dt><strong>events</strong> = ('key_press_event', 'key_release_event', 'button_press_event', 'button_release_event', 'motion_notify_event')</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="GraphicsContextCairo">class <strong>GraphicsContextCairo</strong></a>(<a href="matplotlib.backend_bases.html#GraphicsContextBase">matplotlib.backend_bases.GraphicsContextBase</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="GraphicsContextCairo-__init__"><strong>__init__</strong></a>(self, renderer)</dt></dl>
<dl><dt><a name="GraphicsContextCairo-set_alpha"><strong>set_alpha</strong></a>(self, alpha)</dt></dl>
<dl><dt><a name="GraphicsContextCairo-set_capstyle"><strong>set_capstyle</strong></a>(self, cs)</dt></dl>
<dl><dt><a name="GraphicsContextCairo-set_clip_rectangle"><strong>set_clip_rectangle</strong></a>(self, rectangle)</dt></dl>
<dl><dt><a name="GraphicsContextCairo-set_dashes"><strong>set_dashes</strong></a>(self, offset, dashes)</dt></dl>
<dl><dt><a name="GraphicsContextCairo-set_foreground"><strong>set_foreground</strong></a>(self, fg, isRGB<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="GraphicsContextCairo-set_graylevel"><strong>set_graylevel</strong></a>(self, frac)</dt></dl>
<dl><dt><a name="GraphicsContextCairo-set_joinstyle"><strong>set_joinstyle</strong></a>(self, js)</dt></dl>
<dl><dt><a name="GraphicsContextCairo-set_linewidth"><strong>set_linewidth</strong></a>(self, w)</dt></dl>
<hr>
Methods inherited from <a href="matplotlib.backend_bases.html#GraphicsContextBase">matplotlib.backend_bases.GraphicsContextBase</a>:<br>
<dl><dt><a name="GraphicsContextCairo-copy_properties"><strong>copy_properties</strong></a>(self, gc)</dt><dd><tt>Copy properties from gc to self</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_alpha"><strong>get_alpha</strong></a>(self)</dt><dd><tt>Return the alpha value used for blending - not supported on<br>
all backends</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_antialiased"><strong>get_antialiased</strong></a>(self)</dt><dd><tt>Return true if the object should try to do antialiased rendering</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_capstyle"><strong>get_capstyle</strong></a>(self)</dt><dd><tt>Return the capstyle as a string in ('butt', 'round', 'projecting')</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_clip_rectangle"><strong>get_clip_rectangle</strong></a>(self)</dt><dd><tt>Return the clip rectangle as (left, bottom, width, height)</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_dashes"><strong>get_dashes</strong></a>(self)</dt><dd><tt>Return the dash information as an offset dashlist tuple The<br>
dash list is a even size list that gives the ink on, ink off<br>
in pixels. See p107 of to postscript BLUEBOOK for more info<br>
<br>
Default value is None</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_joinstyle"><strong>get_joinstyle</strong></a>(self)</dt><dd><tt>Return the line join style as one of ('miter', 'round', 'bevel')</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_linestyle"><strong>get_linestyle</strong></a>(self, style)</dt><dd><tt>Return the linestyle: one of ('solid', 'dashed', 'dashdot',<br>
'dotted').</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_linewidth"><strong>get_linewidth</strong></a>(self)</dt><dd><tt>Return the line width in points as a scalar</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-get_rgb"><strong>get_rgb</strong></a>(self)</dt><dd><tt>returns a tuple of three floats from 0-1. color can be a<br>
matlab format string, a html hex color string, or a rgb tuple</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-set_antialiased"><strong>set_antialiased</strong></a>(self, b)</dt><dd><tt>True if object should be drawn with antialiased rendering</tt></dd></dl>
<dl><dt><a name="GraphicsContextCairo-set_linestyle"><strong>set_linestyle</strong></a>(self, style)</dt><dd><tt>Set the linestyle to be one of ('solid', 'dashed', 'dashdot',<br>
'dotted').</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="matplotlib.backend_bases.html#GraphicsContextBase">matplotlib.backend_bases.GraphicsContextBase</a>:<br>
<dl><dt><strong>dashd</strong> = {'dashdot': (0, (3.0, 5.0, 1.0, 5.0)), 'dashed': (0, (6.0, 6.0)), 'dotted': (0, (1.0, 3.0)), 'solid': (None, None)}</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="RendererCairo">class <strong>RendererCairo</strong></a>(<a href="matplotlib.backend_bases.html#RendererBase">matplotlib.backend_bases.RendererBase</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="RendererCairo-__init__"><strong>__init__</strong></a>(self, matrix, dpi)</dt><dd><tt>width, height - the canvas width, height. Is not necessarily<br>
the same as the surface (pixmap) width, height</tt></dd></dl>
<dl><dt><a name="RendererCairo-draw_arc"><strong>draw_arc</strong></a>(self, gc, rgbFace, x, y, width, height, angle1, angle2)</dt></dl>
<dl><dt><a name="RendererCairo-draw_image"><strong>draw_image</strong></a>(self, x, y, im, origin, bbox)</dt></dl>
<dl><dt><a name="RendererCairo-draw_line"><strong>draw_line</strong></a>(self, gc, x1, y1, x2, y2)</dt></dl>
<dl><dt><a name="RendererCairo-draw_lines"><strong>draw_lines</strong></a>(self, gc, x, y)</dt></dl>
<dl><dt><a name="RendererCairo-draw_point"><strong>draw_point</strong></a>(self, gc, x, y)</dt></dl>
<dl><dt><a name="RendererCairo-draw_polygon"><strong>draw_polygon</strong></a>(self, gc, rgbFace, points)</dt></dl>
<dl><dt><a name="RendererCairo-draw_rectangle"><strong>draw_rectangle</strong></a>(self, gc, rgbFace, x, y, width, height)</dt></dl>
<dl><dt><a name="RendererCairo-draw_text"><strong>draw_text</strong></a>(self, gc, x, y, s, prop, angle, ismath<font color="#909090">=False</font>)</dt></dl>
<dl><dt><a name="RendererCairo-flipy"><strong>flipy</strong></a>(self)</dt></dl>
<dl><dt><a name="RendererCairo-get_canvas_width_height"><strong>get_canvas_width_height</strong></a>(self)</dt></dl>
<dl><dt><a name="RendererCairo-get_text_width_height"><strong>get_text_width_height</strong></a>(self, s, prop, ismath)</dt></dl>
<dl><dt><a name="RendererCairo-new_gc"><strong>new_gc</strong></a>(self)</dt></dl>
<dl><dt><a name="RendererCairo-points_to_pixels"><strong>points_to_pixels</strong></a>(self, points)</dt></dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>fontangles</strong> = {'italic': 1, 'normal': 0, 'oblique': 2}</dl>
<dl><dt><strong>fontweights</strong> = {100: 0, 200: 0, 300: 0, 400: 0, 500: 0, 600: 1, 700: 1, 800: 1, 900: 1, 'black': 1, ...}</dl>
<hr>
Methods inherited from <a href="matplotlib.backend_bases.html#RendererBase">matplotlib.backend_bases.RendererBase</a>:<br>
<dl><dt><a name="RendererCairo-close_group"><strong>close_group</strong></a>(self, s)</dt><dd><tt>close a grouping element with label s<br>
Is only currently used by backend_svg</tt></dd></dl>
<dl><dt><a name="RendererCairo-draw_line_collection"><strong>draw_line_collection</strong></a>(self, segments, transform, clipbox, colors, linewidths, linestyle, antialiaseds, offsets, transOffset)</dt><dd><tt>This is a function for optimized line drawing. If you need to<br>
draw many line segments with similar properties, it is faster<br>
to avoid the overhead of all the object creation etc. The<br>
lack of total configurability is compensated for with<br>
efficiency. Hence we don't use a GC and many of the line<br>
props it supports. See matplotlib.collections for more<br>
details<br>
<br>
sements is a sequence of ( line0, line1, line2), where linen =<br>
(x0, y0), (x1, y1), ... (xm, ym). Each line can be a<br>
different length<br>
<br>
transform is used to Transform the lines<br>
<br>
clipbox is a xmin, ymin, width, height clip rect<br>
<br>
colors is a tuple of RGBA tuples<br>
<br>
linewidths is a tuple of linewidths<br>
<br>
linestyle is an (offset, onoffseq) tuple or None,None for solid<br>
<br>
antialiseds is a tuple of ones or zeros indicating whether the<br>
segment should be aa or not<br>
<br>
offsets, if not None, is a list of x,y offsets to translate<br>
the lines by after transoff is used to transform the offset<br>
coords<br>
<br>
This function is intended to be overridden by the backend<br>
level in extension code for backends that want fast line<br>
collection drawing. Here is is implemented using native<br>
backend calls and may be slow</tt></dd></dl>
<dl><dt><a name="RendererCairo-draw_poly_collection"><strong>draw_poly_collection</strong></a>(self, verts, transform, clipbox, facecolors, edgecolors, linewidths, antialiaseds, offsets, transOffset)</dt><dd><tt>Draw a polygon collection<br>
<br>
verts are a sequence of polygon vectors, where each polygon<br>
vector is a sequence of x,y tuples of vertices<br>
<br>
facecolors and edgecolors are a sequence of RGBA tuples<br>
linewidths are a sequence of linewidths<br>
antialiaseds are a sequence of 0,1 integers whether to use aa</tt></dd></dl>
<dl><dt><a name="RendererCairo-draw_regpoly_collection"><strong>draw_regpoly_collection</strong></a>(self, clipbox, offsets, transOffset, verts, sizes, facecolors, edgecolors, linewidths, antialiaseds)</dt><dd><tt>Draw a regular poly collection<br>
<br>
offsets is a sequence is x,y tuples and transOffset maps this<br>
to display coords<br>
<br>
verts are the vertices of the regular polygon at the origin<br>
<br>
sizes are the area of the circle that circumscribes the<br>
polygon in points^2<br>
<br>
facecolors and edgecolors are a sequence of RGBA tuples<br>
linewidths are a sequence of linewidths<br>
antialiaseds are a sequence of 0,1 integers whether to use aa</tt></dd></dl>
<dl><dt><a name="RendererCairo-get_text_extent"><strong>get_text_extent</strong></a>(self, text)</dt><dd><tt>Get the text extent in window coords</tt></dd></dl>
<dl><dt><a name="RendererCairo-open_group"><strong>open_group</strong></a>(self, s)</dt><dd><tt>open a grouping element with label s<br>
Is only currently used by backend_svg</tt></dd></dl>
<dl><dt><a name="RendererCairo-strip_math"><strong>strip_math</strong></a>(self, s)</dt></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-Bbox"><strong>Bbox</strong></a>(...)</dt><dd><tt><a href="#-Bbox">Bbox</a>(ll, ur)</tt></dd></dl>
<dl><dt><a name="-fromstring"><strong>fromstring</strong></a>(...)</dt><dd><tt><a href="#-fromstring">fromstring</a>(string, typecode='l', count=-1) returns a new 1d array initialized from the raw binary data in string. If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.</tt></dd></dl>
<dl><dt><a name="-new_figure_manager"><strong>new_figure_manager</strong></a>(num, *args, **kwargs)</dt><dd><tt>Create a new figure manager instance</tt></dd></dl>
<dl><dt><a name="-print_figure_fn"><strong>print_figure_fn</strong></a>(figure, filename, dpi<font color="#909090">=150</font>, facecolor<font color="#909090">='w'</font>, edgecolor<font color="#909090">='w'</font>, orientation<font color="#909090">='portrait'</font>)</dt></dl>
<dl><dt><a name="-zeros"><strong>zeros</strong></a>(...)</dt><dd><tt><a href="#-zeros">zeros</a>((d1,...,dn),typecode='l',savespace=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero. If savespace is nonzero the array will be a spacesaver array.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>DEBUG</strong> = False<br>
<strong>IMAGE_FORMAT</strong> = ['eps', 'png', 'ps', 'svg']<br>
<strong>IMAGE_FORMAT_DEFAULT</strong> = 'png'<br>
<strong>PIXELS_PER_INCH</strong> = 96<br>
<strong>UInt8</strong> = 'b'<br>
<strong>division</strong> = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)<br>
<strong>pi</strong> = 3.1415926535897931<br>
<strong>verbose</strong> = <matplotlib.Verbose instance></td></tr></table>
@footer@