Menu

Tree [r7974] / branches / mathtex / examples / api /
 History

HTTPS access


File Date Author Commit
 README.txt 2008-05-16 jdh2358 [r5161] updated api readme
 agg_oo.py 2008-10-17 mdboom [r6251] Include output images in examples in documentat...
 barchart_demo.py 2008-12-09 jdh2358 [r6535] removed extraneous savefig calls from examples
 bbox_intersect.py 2008-09-09 mdboom [r6076] Add unit test for Path.intersects_bbox.
 clippath_demo.py 2009-01-29 jdh2358 [r6848] added another image clippath demo; forgot there...
 collections_demo.py 2008-06-05 mdboom [r5403] Fix dpi-changing-related bugs in Axes.scatter()
 color_cycle.py 2008-05-24 efiring [r5251] Forgot to add the example on last commit
 colorbar_only.py 2008-05-16 jdh2358 [r5151] reorganized examples
 compound_path.py 2009-04-01 jdh2358 [r7022] added compound path demo
 custom_projection_example.py 2009-06-01 astraw [r7170] Spine is now derived from Patch
 custom_scale_example.py 2008-05-23 mdboom [r5230] Move examples from pylab to api.
 date_demo.py 2009-08-12 evilguru [r7479] Backport recent changes in trunk to the mathtex...
 date_index_formatter.py 2009-08-12 evilguru [r7479] Backport recent changes in trunk to the mathtex...
 donut_demo.py 2008-09-03 mdboom [r6062] Add donut demo (to demonstrate compound paths)
 fahrenheit_celcius_scales.py 2009-06-05 jdh2358 [r7178] added JJ's F/C two scale example
 font_family_rc.py 2008-10-17 mdboom [r6251] Include output images in examples in documentat...
 font_file.py 2008-10-17 mdboom [r6251] Include output images in examples in documentat...
 histogram_demo.py 2008-12-09 jdh2358 [r6535] removed extraneous savefig calls from examples
 image_zcoord.py 2008-05-18 jdh2358 [r5188] added z coordinate example for nearest neighbor...
 joinstyle.py 2009-03-10 jouni [r6971] Fix join style bug in pdf.
 legend_demo.py 2008-07-02 jdh2358 [r5705] cleaned legend demo example
 line_with_text.py 2008-07-03 jdh2358 [r5708] fixed text picking
 logo2.py 2009-03-05 mdboom [r6957] Fix logo-generation script to have rounded pola...
 patch_collection.py 2008-11-14 pkienzle [r6404] patches: allow partial rings with Wedge
 path_patch_demo.py 2008-05-30 jdh2358 [r5322] updated path example
 quad_bezier.py 2009-01-29 mdboom [r6847] Rework the nan-handling/clipping/quantizing/sim...
 radar_chart.py 2009-07-29 evilguru [r7306] Update the mathtex branch so that it is up-to-d...
 scatter_piecharts.py 2008-05-16 jdh2358 [r5151] reorganized examples
 span_regions.py 2008-11-23 jdh2358 [r6437] moved fill_between to axes/pyplot method
 two_scales.py 2008-11-29 efiring [r6456] Make scale colors match line colors in two_scal...
 unicode_minus.py 2008-11-25 jdh2358 [r6453] added rc param axes.unicode_minus
 watermark_image.py 2009-08-12 evilguru [r7479] Backport recent changes in trunk to the mathtex...
 watermark_text.py 2008-12-09 jdh2358 [r6535] removed extraneous savefig calls from examples

Read Me

matplotlib API
==============

These examples use the matplotlib api rather than the pylab/pyplot
procedural state machine.  For robust, production level scripts, or
for applications or web application servers, we recommend you use the
matplotlib API directly as it gives you the maximum control over your
figures, axes and plottng commands.  There are a few documentation
resources for the API

  - the matplotlib artist tutorial :
    http://matplotlib.sourceforge.net/pycon/artist_api_tut.pdf

  - the "leftwich tutorial" :
    http://matplotlib.sourceforge.net/leftwich_tut.txt

 The example agg_oo.py is the simplest example of using the Agg
 backend which is readily ported to other output formats.  This
 example is a good starting point if your are a web application
 developer.  Many of the other examples in this directory use
 matplotlib.pyplot just to create the figure and show calls, and use
 the API for everything else.  This is a good solution for production
 quality scripts.  For full fledged GUI applications, see the
 user_interfaces examples.

Example style guide
===================

If you are creating new examples, you cannot import pylab or import *
from any module in your examples.  The only three functions allowed
from pyplot are "figure", "show" and "close", which you can use as
convenience functions for managing figures.  All other matplotlib
functionality must illustrate the API.

A simple example of the recommended style is::

    import numpy as np
    import matplotlib.pyplot as plt

    fig = plt.figure()
    ax = fig.add_subplot(111) # or add_axes
    ax.plot(np.random.rand(10))
    ax.set_xlabel('some x data')
    ax.set_ylabel('some y data')
    ax.set_title('some title')
    ax.grid(True)
    fig.savefig('myfig')
    plt.show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.