|
From: <jd...@us...> - 2008-06-13 17:19:03
|
Revision: 5513
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5513&view=rev
Author: jdh2358
Date: 2008-06-13 10:18:41 -0700 (Fri, 13 Jun 2008)
Log Message:
-----------
moved figure autogen into plot directive
Modified Paths:
--------------
trunk/matplotlib/doc/devel/documenting_mpl.rst
trunk/matplotlib/doc/make.py
trunk/matplotlib/doc/sphinxext/plot_directive.py
trunk/matplotlib/doc/users/annotations.rst
trunk/matplotlib/doc/users/artists.rst
trunk/matplotlib/doc/users/mathtext.rst
trunk/matplotlib/doc/users/pyplot_tutorial.rst
trunk/matplotlib/doc/users/text_intro.rst
trunk/matplotlib/doc/users/text_props.rst
Added Paths:
-----------
trunk/matplotlib/doc/matplotlibrc
trunk/matplotlib/doc/pyplots/
trunk/matplotlib/doc/pyplots/annotation_basic.py
trunk/matplotlib/doc/pyplots/annotation_polar.py
trunk/matplotlib/doc/pyplots/dollar_ticks.py
trunk/matplotlib/doc/pyplots/fig_axes_customize_simple.py
trunk/matplotlib/doc/pyplots/fig_axes_labels_simple.py
trunk/matplotlib/doc/pyplots/fig_x.py
trunk/matplotlib/doc/pyplots/make.py
trunk/matplotlib/doc/pyplots/matplotlibrc
trunk/matplotlib/doc/pyplots/pyplot_annotate.py
trunk/matplotlib/doc/pyplots/pyplot_formatstr.py
trunk/matplotlib/doc/pyplots/pyplot_mathtext.py
trunk/matplotlib/doc/pyplots/pyplot_simple.py
trunk/matplotlib/doc/pyplots/pyplot_text.py
trunk/matplotlib/doc/pyplots/pyplot_three.py
trunk/matplotlib/doc/pyplots/pyplot_two_subplots.py
trunk/matplotlib/doc/pyplots/text_commands.py
trunk/matplotlib/doc/pyplots/text_layout.py
Removed Paths:
-------------
trunk/matplotlib/doc/pyplots/annotation_basic.py
trunk/matplotlib/doc/pyplots/annotation_polar.py
trunk/matplotlib/doc/pyplots/dollar_ticks.py
trunk/matplotlib/doc/pyplots/fig_axes_customize_simple.py
trunk/matplotlib/doc/pyplots/fig_axes_labels_simple.py
trunk/matplotlib/doc/pyplots/fig_x.py
trunk/matplotlib/doc/pyplots/make.py
trunk/matplotlib/doc/pyplots/matplotlibrc
trunk/matplotlib/doc/pyplots/pyplot_annotate.py
trunk/matplotlib/doc/pyplots/pyplot_formatstr.py
trunk/matplotlib/doc/pyplots/pyplot_mathtext.py
trunk/matplotlib/doc/pyplots/pyplot_simple.py
trunk/matplotlib/doc/pyplots/pyplot_text.py
trunk/matplotlib/doc/pyplots/pyplot_three.py
trunk/matplotlib/doc/pyplots/pyplot_two_subplots.py
trunk/matplotlib/doc/pyplots/text_commands.py
trunk/matplotlib/doc/pyplots/text_layout.py
trunk/matplotlib/doc/users/figures/
Modified: trunk/matplotlib/doc/devel/documenting_mpl.rst
===================================================================
--- trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-06-13 15:54:21 UTC (rev 5512)
+++ trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-06-13 17:18:41 UTC (rev 5513)
@@ -102,14 +102,19 @@
Dynamically generated figures
-----------------------------
-Each guide will have its own `figures/` directory for scripts to generate images
-to be included in the documentation. It is not necessary to explicitly save
-the figure in the script, a figure will be saved with the same name as the
-filename when the documentation is generated. Matplotlib includes a Sphinx
-extension for generating the images from the python script and including either
-a png copy for html or a pdf for latex::
+The top level :file:`doc` dir has a folder called :file:`pyplots` in
+which you should include any pyplot plotting scripts that you want to
+generate figures for the documentation. It is not necessary to
+explicitly save the figure in the script, this will be done
+automatically at build time to insure that the code that is included
+runs and produces the advertised figure. Several figures will be
+saved with the same basnename as the filename when the documentation
+is generated (low and high res PNGs, a PDF). Matplotlib includes a
+Sphinx extension (file:`sphinxext/plot_directive.py`) for generating
+the images from the python script and including either a png copy for
+html or a pdf for latex::
- .. plot:: figures/pyplot_simple
+ .. plot:: pyplot_simple.py
:scale: 75
:include-source:
Modified: trunk/matplotlib/doc/make.py
===================================================================
--- trunk/matplotlib/doc/make.py 2008-06-13 15:54:21 UTC (rev 5512)
+++ trunk/matplotlib/doc/make.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -23,18 +23,18 @@
def html():
check_build()
- figs()
+ #figs()
if os.system('sphinx-build -b html -d build/doctrees . build/html'):
raise SystemExit("Building HTML failed.")
- figures_dest_path = 'build/html/users/figures'
+ figures_dest_path = 'build/html/pyplots'
if os.path.exists(figures_dest_path):
shutil.rmtree(figures_dest_path)
- shutil.copytree('users/figures', figures_dest_path)
+ shutil.copytree('pyplots', figures_dest_path)
def latex():
check_build()
- figs()
+ #figs()
if sys.platform != 'win32':
# LaTeX format.
if os.system('sphinx-build -b latex -d build/doctrees . build/latex'):
@@ -57,9 +57,11 @@
def clean():
shutil.rmtree('build')
+ for fname in glob.glob('pyplots/*.png') + glob.glob('pyplots/*.pdf'):
+ os.remove(fname)
def all():
- figs()
+ #figs()
html()
latex()
Added: trunk/matplotlib/doc/matplotlibrc
===================================================================
--- trunk/matplotlib/doc/matplotlibrc (rev 0)
+++ trunk/matplotlib/doc/matplotlibrc 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,315 @@
+### MATPLOTLIBRC FORMAT
+
+# This is a sample matplotlib configuration file. It should be placed
+# in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and
+# C:\Documents and Settings\yourname\.matplotlib (win32 systems)
+#
+# By default, the installer will overwrite the existing file in the
+# install path, so if you want to preserve your's, please move it to
+# your HOME dir and set the environment variable if necessary.
+#
+# This file is best viewed in a editor which supports python mode
+# syntax highlighting
+#
+# Blank lines, or lines starting with a comment symbol, are ignored,
+# as are trailing comments. Other lines must have the format
+#
+# key : val # optional comment
+#
+# Colors: for the color values below, you can either use
+# - a matplotlib color string, such as r, k, or b
+# - an rgb tuple, such as (1.0, 0.5, 0.0)
+# - a hex string, such as ff00ff (no '#' symbol)
+# - a scalar grayscale intensity such as 0.75
+# - a legal html color name, eg red, blue, darkslategray
+
+#### CONFIGURATION BEGINS HERE
+# the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg
+# WX WXAgg Agg Cairo GD GDK Paint PS PDF SVG Template
+backend : Agg
+numerix : numpy # numpy, Numeric or numarray
+#maskedarray : False # True to use external maskedarray module
+ # instead of numpy.ma; this is a temporary
+ # setting for testing maskedarray.
+#interactive : False # see http://matplotlib.sourceforge.net/interactive.html
+#toolbar : toolbar2 # None | classic | toolbar2
+#timezone : UTC # a pytz timezone string, eg US/Central or Europe/Paris
+
+# Where your matplotlib data lives if you installed to a non-default
+# location. This is where the matplotlib fonts, bitmaps, etc reside
+#datapath : /home/jdhunter/mpldata
+
+
+### LINES
+# See http://matplotlib.sourceforge.net/matplotlib.lines.html for more
+# information on line properties.
+#lines.linewidth : 1.0 # line width in points
+#lines.linestyle : - # solid line
+#lines.color : blue
+#lines.marker : None # the default marker
+#lines.markeredgewidth : 0.5 # the line width around the marker symbol
+#lines.markersize : 6 # markersize, in points
+#lines.dash_joinstyle : miter # miter|round|bevel
+#lines.dash_capstyle : butt # butt|round|projecting
+#lines.solid_joinstyle : miter # miter|round|bevel
+#lines.solid_capstyle : projecting # butt|round|projecting
+#lines.antialiased : True # render lines in antialised (no jaggies)
+
+### PATCHES
+# Patches are graphical objects that fill 2D space, like polygons or
+# circles. See
+# http://matplotlib.sourceforge.net/matplotlib.patches.html for more
+# information on patch properties
+#patch.linewidth : 1.0 # edge width in points
+#patch.facecolor : blue
+#patch.edgecolor : black
+#patch.antialiased : True # render patches in antialised (no jaggies)
+
+### FONT
+#
+# font properties used by text.Text. See
+# http://matplotlib.sourceforge.net/matplotlib.font_manager.html for more
+# information on font properties. The 6 font properties used for font
+# matching are given below with their default values.
+#
+# The font.family property has five values: 'serif' (e.g. Times),
+# 'sans-serif' (e.g. Helvetica), 'cursive' (e.g. Zapf-Chancery),
+# 'fantasy' (e.g. Western), and 'monospace' (e.g. Courier). Each of
+# these font families has a default list of font names in decreasing
+# order of priority associated with them.
+#
+# The font.style property has three values: normal (or roman), italic
+# or oblique. The oblique style will be used for italic, if it is not
+# present.
+#
+# The font.variant property has two values: normal or small-caps. For
+# TrueType fonts, which are scalable fonts, small-caps is equivalent
+# to using a font size of 'smaller', or about 83% of the current font
+# size.
+#
+# The font.weight property has effectively 13 values: normal, bold,
+# bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as
+# 400, and bold is 700. bolder and lighter are relative values with
+# respect to the current weight.
+#
+# The font.stretch property has 11 values: ultra-condensed,
+# extra-condensed, condensed, semi-condensed, normal, semi-expanded,
+# expanded, extra-expanded, ultra-expanded, wider, and narrower. This
+# property is not currently implemented.
+#
+# The font.size property is the default font size for text, given in pts.
+# 12pt is the standard value.
+#
+#font.family : sans-serif
+#font.style : normal
+#font.variant : normal
+#font.weight : medium
+#font.stretch : normal
+# note that font.size controls default text sizes. To configure
+# special text sizes tick labels, axes, labels, title, etc, see the rc
+# settings for axes and ticks. Special text sizes can be defined
+# relative to font.size, using the following values: xx-small, x-small,
+# small, medium, large, x-large, xx-large, larger, or smaller
+#font.size : 12.0
+#font.serif : Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
+#font.sans-serif : Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
+#font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, cursive
+#font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact, Western, fantasy
+#font.monospace : Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace
+
+### TEXT
+# text properties used by text.Text. See
+# http://matplotlib.sourceforge.net/matplotlib.text.html for more
+# information on text properties
+
+#text.color : black
+
+### LaTeX customizations. See http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex
+#text.usetex : False # use latex for all text handling. The following fonts
+ # are supported through the usual rc parameter settings:
+ # new century schoolbook, bookman, times, palatino,
+ # zapf chancery, charter, serif, sans-serif, helvetica,
+ # avant garde, courier, monospace, computer modern roman,
+ # computer modern sans serif, computer modern typewriter
+ # If another font is desired which can loaded using the
+ # LaTeX \usepackage command, please inquire at the
+ # matplotlib mailing list
+#text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
+ # unicode strings.
+#text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
+ # AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
+ # IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.
+ # preamble is a comma separated list of LaTeX statements
+ # that are included in the LaTeX document preamble.
+ # An example:
+ # text.latex.preamble : \usepackage{bm},\usepackage{euler}
+ # The following packages are always loaded with usetex, so
+ # beware of package collisions: color, geometry, graphicx,
+ # type1cm, textcomp. Adobe Postscript (PSSNFS) font packages
+ # may also be loaded, depending on your font settings
+#text.dvipnghack : False # some versions of dvipng don't handle
+ # alpha channel properly. Use True to correct and flush
+ # ~/.matplotlib/tex.cache before testing
+#text.markup : 'plain' # Affects how text, such as titles and labels, are
+ # interpreted by default.
+ # 'plain': As plain, unformatted text
+ # 'tex': As TeX-like text. Text between $'s will be
+ # formatted as a TeX math expression.
+ # This setting has no effect when text.usetex is True.
+ # In that case, all text will be sent to TeX for
+ # processing.
+
+# The following settings allow you to select the fonts in math mode.
+# They map from a TeX font name to a fontconfig font pattern.
+# These settings are only used if mathtext.fontset is 'custom'.
+#mathtext.cal : cursive
+#mathtext.rm : serif
+#mathtext.tt : monospace
+#mathtext.it : serif:italic
+#mathtext.bf : serif:bold
+#mathtext.sf : sans
+#mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix',
+ # 'stixsans' or 'custom'
+#mathtext.fallback_to_cm : True # When True, use symbols from the Computer Modern
+ # fonts when a symbol can not be found in one of
+ # the custom math fonts.
+
+### AXES
+# default face and edge color, default tick sizes,
+# default fontsizes for ticklabels, and so on. See
+# http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes
+#axes.hold : True # whether to clear the axes by default on
+#axes.facecolor : white # axes background color
+#axes.edgecolor : black # axes edge color
+#axes.linewidth : 1.0 # edge linewidth
+#axes.grid : False # display grid or not
+#axes.titlesize : 14 # fontsize of the axes title
+#axes.labelsize : 12 # fontsize of the x any y labels
+#axes.labelcolor : black
+#axes.axisbelow : False # whether axis gridlines and ticks are below
+ # the axes elements (lines, text, etc)
+#axes.formatter.limits : -7, 7 # use scientific notation if log10
+ # of the axis range is smaller than the
+ # first or larger than the second
+
+#polaraxes.grid : True # display grid on polar axes
+
+### TICKS
+# see http://matplotlib.sourceforge.net/matplotlib.axis.html#Ticks
+#xtick.major.size : 4 # major tick size in points
+#xtick.minor.size : 2 # minor tick size in points
+#xtick.major.pad : 4 # distance to major tick label in points
+#xtick.minor.pad : 4 # distance to the minor tick label in points
+#xtick.color : k # color of the tick labels
+#xtick.labelsize : 12 # fontsize of the tick labels
+#xtick.direction : in # direction: in or out
+
+#ytick.major.size : 4 # major tick size in points
+#ytick.minor.size : 2 # minor tick size in points
+#ytick.major.pad : 4 # distance to major tick label in points
+#ytick.minor.pad : 4 # distance to the minor tick label in points
+#ytick.color : k # color of the tick labels
+#ytick.labelsize : 12 # fontsize of the tick labels
+#ytick.direction : in # direction: in or out
+
+
+### GRIDS
+#grid.color : black # grid color
+#grid.linestyle : : # dotted
+#grid.linewidth : 0.5 # in points
+
+### Legend
+#legend.isaxes : True
+#legend.numpoints : 2 # the number of points in the legend line
+#legend.fontsize : 14
+#legend.pad : 0.2 # the fractional whitespace inside the legend border
+#legend.markerscale : 1.0 # the relative size of legend markers vs. original
+# the following dimensions are in axes coords
+#legend.labelsep : 0.010 # the vertical space between the legend entries
+#legend.handlelen : 0.05 # the length of the legend lines
+#legend.handletextsep : 0.02 # the space between the legend line and legend text
+#legend.axespad : 0.02 # the border between the axes and legend edge
+#legend.shadow : False
+
+### FIGURE
+# See http://matplotlib.sourceforge.net/matplotlib.figure.html#Figure
+#figure.figsize : 8, 6 # figure size in inches
+#figure.dpi : 80 # figure dots per inch
+#figure.facecolor : 0.75 # figure facecolor; 0.75 is scalar gray
+#figure.edgecolor : white # figure edgecolor
+
+# The figure subplot parameters. All dimensions are fraction of the
+# figure width or height
+#figure.subplot.left : 0.125 # the left side of the subplots of the figure
+#figure.subplot.right : 0.9 # the right side of the subplots of the figure
+#figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure
+#figure.subplot.top : 0.9 # the top of the subplots of the figure
+#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
+#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
+
+#figure.autolayout : False # when True, adjust the axes so that text doesn't overlap
+
+### IMAGES
+#image.aspect : equal # equal | auto | a number
+#image.interpolation : bilinear # see help(imshow) for options
+#image.cmap : jet # gray | jet etc...
+#image.lut : 256 # the size of the colormap lookup table
+#image.origin : upper # lower | upper
+
+
+### CONTOUR PLOTS
+#contour.negative_linestyle : dashed # dashed | solid
+
+### SAVING FIGURES
+# the default savefig params can be different for the GUI backends.
+# Eg, you may want a higher resolution, or to make the figure
+# background white
+#savefig.dpi : 100 # figure dots per inch
+#savefig.facecolor : white # figure facecolor when saving
+#savefig.edgecolor : white # figure edgecolor when saving
+
+#cairo.format : png # png, ps, pdf, svg
+
+# tk backend params
+#tk.window_focus : False # Maintain shell focus for TkAgg
+#tk.pythoninspect : False # tk sets PYTHONINSEPCT
+
+# ps backend params
+#ps.papersize : letter # auto, letter, legal, ledger, A0-A10, B0-B10
+#ps.useafm : False # use of afm fonts, results in small files
+#ps.usedistiller : False # can be: None, ghostscript or xpdf
+ # Experimental: may produce smaller files.
+ # xpdf intended for production of publication quality files,
+ # but requires ghostscript, xpdf and ps2eps
+#ps.distiller.res : 6000 # dpi
+#ps.fonttype : 3 # Output Type 3 (Type3) or Type 42 (TrueType)
+
+# pdf backend params
+#pdf.compression : 6 # integer from 0 to 9
+ # 0 disables compression (good for debugging)
+#pdf.fonttype : 3 # Output Type 3 (Type3) or Type 42 (TrueType)
+
+# svg backend params
+#svg.image_inline : True # write raster image data directly into the svg file
+#svg.image_noscale : False # suppress scaling of raster data embedded in SVG
+#svg.embed_chars : True # embed character outlines in the SVG file
+
+# Set the verbose flags. This controls how much information
+# matplotlib gives you at runtime and where it goes. The verbosity
+# levels are: silent, helpful, debug, debug-annoying. Any level is
+# inclusive of all the levels below it. If you setting is debug,
+# you'll get all the debug and helpful messages. When submitting
+# problems to the mailing-list, please set verbose to helpful or debug
+# and paste the output into your report.
+#
+# The fileo gives the destination for any calls to verbose.report.
+# These objects can a filename, or a filehandle like sys.stdout.
+#
+# You can override the rc default verbosity from the command line by
+# giving the flags --verbose-LEVEL where LEVEL is one of the legal
+# levels, eg --verbose-helpful.
+#
+# You can access the verbose instance in your code
+# from matplotlib import verbose.
+#verbose.level : silent # one of silent, helpful, debug, debug-annoying
+#verbose.fileo : sys.stdout # a log filename, sys.stdout or sys.stderr
Copied: trunk/matplotlib/doc/pyplots (from rev 5507, trunk/matplotlib/doc/users/figures)
Deleted: trunk/matplotlib/doc/pyplots/annotation_basic.py
===================================================================
--- trunk/matplotlib/doc/users/figures/annotation_basic.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/annotation_basic.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,16 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-
-t = np.arange(0.0, 5.0, 0.01)
-s = np.cos(2*np.pi*t)
-line, = ax.plot(t, s, lw=2)
-
-ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
- arrowprops=dict(facecolor='black', shrink=0.05),
- )
-
-ax.set_ylim(-2,2)
-plt.show()
Copied: trunk/matplotlib/doc/pyplots/annotation_basic.py (from rev 5512, trunk/matplotlib/doc/users/figures/annotation_basic.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/annotation_basic.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/annotation_basic.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,16 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+
+t = np.arange(0.0, 5.0, 0.01)
+s = np.cos(2*np.pi*t)
+line, = ax.plot(t, s, lw=2)
+
+ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
+ arrowprops=dict(facecolor='black', shrink=0.05),
+ )
+
+ax.set_ylim(-2,2)
+plt.show()
Deleted: trunk/matplotlib/doc/pyplots/annotation_polar.py
===================================================================
--- trunk/matplotlib/doc/users/figures/annotation_polar.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/annotation_polar.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,21 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax = fig.add_subplot(111, polar=True)
-r = np.arange(0,1,0.001)
-theta = 2*2*np.pi*r
-line, = ax.plot(theta, r, color='#ee8d18', lw=3)
-
-ind = 800
-thisr, thistheta = r[ind], theta[ind]
-ax.plot([thistheta], [thisr], 'o')
-ax.annotate('a polar annotation',
- xy=(thistheta, thisr), # theta, radius
- xytext=(0.05, 0.05), # fraction, fraction
- textcoords='figure fraction',
- arrowprops=dict(facecolor='black', shrink=0.05),
- horizontalalignment='left',
- verticalalignment='bottom',
- )
-plt.show()
Copied: trunk/matplotlib/doc/pyplots/annotation_polar.py (from rev 5512, trunk/matplotlib/doc/users/figures/annotation_polar.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/annotation_polar.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/annotation_polar.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,21 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+ax = fig.add_subplot(111, polar=True)
+r = np.arange(0,1,0.001)
+theta = 2*2*np.pi*r
+line, = ax.plot(theta, r, color='#ee8d18', lw=3)
+
+ind = 800
+thisr, thistheta = r[ind], theta[ind]
+ax.plot([thistheta], [thisr], 'o')
+ax.annotate('a polar annotation',
+ xy=(thistheta, thisr), # theta, radius
+ xytext=(0.05, 0.05), # fraction, fraction
+ textcoords='figure fraction',
+ arrowprops=dict(facecolor='black', shrink=0.05),
+ horizontalalignment='left',
+ verticalalignment='bottom',
+ )
+plt.show()
Deleted: trunk/matplotlib/doc/pyplots/dollar_ticks.py
===================================================================
--- trunk/matplotlib/doc/users/figures/dollar_ticks.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/dollar_ticks.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,17 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.ticker as ticker
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.plot(100*np.random.rand(20))
-
-formatter = ticker.FormatStrFormatter('$%1.2f')
-ax.yaxis.set_major_formatter(formatter)
-
-for tick in ax.yaxis.get_major_ticks():
- tick.label1On = False
- tick.label2On = True
- tick.label2.set_color('green')
-
-
Copied: trunk/matplotlib/doc/pyplots/dollar_ticks.py (from rev 5512, trunk/matplotlib/doc/users/figures/dollar_ticks.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/dollar_ticks.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/dollar_ticks.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,17 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.ticker as ticker
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.plot(100*np.random.rand(20))
+
+formatter = ticker.FormatStrFormatter('$%1.2f')
+ax.yaxis.set_major_formatter(formatter)
+
+for tick in ax.yaxis.get_major_ticks():
+ tick.label1On = False
+ tick.label2On = True
+ tick.label2.set_color('green')
+
+
Deleted: trunk/matplotlib/doc/pyplots/fig_axes_customize_simple.py
===================================================================
--- trunk/matplotlib/doc/users/figures/fig_axes_customize_simple.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/fig_axes_customize_simple.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,27 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-# plt.figure creates a matplotlib.figure.Figure instance
-fig = plt.figure()
-rect = fig.figurePatch # a rectangle instance
-rect.set_facecolor('lightgoldenrodyellow')
-
-ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])
-rect = ax1.axesPatch
-rect.set_facecolor('lightslategray')
-
-
-for label in ax1.xaxis.get_ticklabels():
- # label is a Text instance
- label.set_color('red')
- label.set_rotation(45)
- label.set_fontsize(16)
-
-for line in ax1.yaxis.get_ticklines():
- # line is a Line2D instance
- line.set_color('green')
- line.set_markersize(25)
- line.set_markeredgewidth(3)
-
-
-
Copied: trunk/matplotlib/doc/pyplots/fig_axes_customize_simple.py (from rev 5512, trunk/matplotlib/doc/users/figures/fig_axes_customize_simple.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/fig_axes_customize_simple.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/fig_axes_customize_simple.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,27 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+# plt.figure creates a matplotlib.figure.Figure instance
+fig = plt.figure()
+rect = fig.figurePatch # a rectangle instance
+rect.set_facecolor('lightgoldenrodyellow')
+
+ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])
+rect = ax1.axesPatch
+rect.set_facecolor('lightslategray')
+
+
+for label in ax1.xaxis.get_ticklabels():
+ # label is a Text instance
+ label.set_color('red')
+ label.set_rotation(45)
+ label.set_fontsize(16)
+
+for line in ax1.yaxis.get_ticklines():
+ # line is a Line2D instance
+ line.set_color('green')
+ line.set_markersize(25)
+ line.set_markeredgewidth(3)
+
+
+
Deleted: trunk/matplotlib/doc/pyplots/fig_axes_labels_simple.py
===================================================================
--- trunk/matplotlib/doc/users/figures/fig_axes_labels_simple.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/fig_axes_labels_simple.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,19 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-fig.subplots_adjust(top=0.8)
-ax1 = fig.add_subplot(211)
-ax1.set_ylabel('volts')
-ax1.set_title('a sine wave')
-
-t = np.arange(0.0, 1.0, 0.01)
-s = np.sin(2*np.pi*t)
-line, = ax1.plot(t, s, color='blue', lw=2)
-
-ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
-n, bins, patches = ax2.hist(np.random.randn(1000), 50,
- facecolor='yellow', edgecolor='yellow')
-ax2.set_xlabel('time (s)')
-
-
Copied: trunk/matplotlib/doc/pyplots/fig_axes_labels_simple.py (from rev 5512, trunk/matplotlib/doc/users/figures/fig_axes_labels_simple.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/fig_axes_labels_simple.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/fig_axes_labels_simple.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,19 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+fig.subplots_adjust(top=0.8)
+ax1 = fig.add_subplot(211)
+ax1.set_ylabel('volts')
+ax1.set_title('a sine wave')
+
+t = np.arange(0.0, 1.0, 0.01)
+s = np.sin(2*np.pi*t)
+line, = ax1.plot(t, s, color='blue', lw=2)
+
+ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
+n, bins, patches = ax2.hist(np.random.randn(1000), 50,
+ facecolor='yellow', edgecolor='yellow')
+ax2.set_xlabel('time (s)')
+
+
Deleted: trunk/matplotlib/doc/pyplots/fig_x.py
===================================================================
--- trunk/matplotlib/doc/users/figures/fig_x.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/fig_x.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,12 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.lines as lines
-fig = plt.figure()
-
-l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
-
-l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
-
-fig.lines.extend([l1, l2])
-
-
Copied: trunk/matplotlib/doc/pyplots/fig_x.py (from rev 5512, trunk/matplotlib/doc/users/figures/fig_x.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/fig_x.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/fig_x.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,12 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.lines as lines
+fig = plt.figure()
+
+l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
+
+l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
+
+fig.lines.extend([l1, l2])
+
+
Deleted: trunk/matplotlib/doc/pyplots/make.py
===================================================================
--- trunk/matplotlib/doc/users/figures/make.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/make.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-import sys, os, glob
-import matplotlib
-import IPython.Shell
-#matplotlib.rcdefaults()
-matplotlib.use('Agg')
-
-mplshell = IPython.Shell.MatplotlibShell('mpl')
-
-formats = [('png', 100),
- ('hires.png', 200),
- ('pdf', 72)]
-
-def figs():
- print 'making figs'
- import matplotlib.pyplot as plt
- for fname in glob.glob('*.py'):
- if fname==__file__: continue
- basename, ext = os.path.splitext(fname)
- outfiles = ['%s.%s' % (basename, format) for format, dpi in formats]
- all_exists = True
- for format, dpi in formats:
- if not os.path.exists('%s.%s' % (basename, format)):
- all_exists = False
- break
-
- if all_exists:
- print ' already have %s'%fname
- else:
- print ' building %s'%fname
- plt.close('all') # we need to clear between runs
- mplshell.magic_run(basename)
- for format, dpi in formats:
- plt.savefig('%s.%s' % (basename, format), dpi=dpi)
- print 'all figures made'
-
-
-def clean():
- patterns = (['#*', '*~', '*pyc'] +
- ['*.%s' % format for format, dpi in formats])
- for pattern in patterns:
- for fname in glob.glob(pattern):
- os.remove(fname)
- print 'all clean'
-
-
-
-def all():
- figs()
-
-funcd = {'figs':figs,
- 'clean':clean,
- 'all':all,
- }
-
-if len(sys.argv)>1:
- for arg in sys.argv[1:]:
- func = funcd.get(arg)
- if func is None:
- raise SystemExit('Do not know how to handle %s; valid args are'%(
- arg, funcd.keys()))
- func()
-else:
- all()
-
-
-
-
Copied: trunk/matplotlib/doc/pyplots/make.py (from rev 5512, trunk/matplotlib/doc/users/figures/make.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/make.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/make.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+import sys, os, glob
+import matplotlib
+import IPython.Shell
+#matplotlib.rcdefaults()
+matplotlib.use('Agg')
+
+mplshell = IPython.Shell.MatplotlibShell('mpl')
+
+formats = [('png', 100),
+ ('hires.png', 200),
+ ('pdf', 72)]
+
+def figs():
+ print 'making figs'
+ import matplotlib.pyplot as plt
+ for fname in glob.glob('*.py'):
+ if fname==__file__: continue
+ basename, ext = os.path.splitext(fname)
+ outfiles = ['%s.%s' % (basename, format) for format, dpi in formats]
+ all_exists = True
+ for format, dpi in formats:
+ if not os.path.exists('%s.%s' % (basename, format)):
+ all_exists = False
+ break
+
+ if all_exists:
+ print ' already have %s'%fname
+ else:
+ print ' building %s'%fname
+ plt.close('all') # we need to clear between runs
+ mplshell.magic_run(basename)
+ for format, dpi in formats:
+ plt.savefig('%s.%s' % (basename, format), dpi=dpi)
+ print 'all figures made'
+
+
+def clean():
+ patterns = (['#*', '*~', '*pyc'] +
+ ['*.%s' % format for format, dpi in formats])
+ for pattern in patterns:
+ for fname in glob.glob(pattern):
+ os.remove(fname)
+ print 'all clean'
+
+
+
+def all():
+ figs()
+
+funcd = {'figs':figs,
+ 'clean':clean,
+ 'all':all,
+ }
+
+if len(sys.argv)>1:
+ for arg in sys.argv[1:]:
+ func = funcd.get(arg)
+ if func is None:
+ raise SystemExit('Do not know how to handle %s; valid args are'%(
+ arg, funcd.keys()))
+ func()
+else:
+ all()
+
+
+
+
Deleted: trunk/matplotlib/doc/pyplots/matplotlibrc
===================================================================
Copied: trunk/matplotlib/doc/pyplots/matplotlibrc (from rev 5512, trunk/matplotlib/doc/users/figures/matplotlibrc)
===================================================================
Deleted: trunk/matplotlib/doc/pyplots/pyplot_annotate.py
===================================================================
--- trunk/matplotlib/doc/users/figures/pyplot_annotate.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/pyplot_annotate.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,15 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-ax = plt.subplot(111)
-
-t = np.arange(0.0, 5.0, 0.01)
-s = np.cos(2*np.pi*t)
-line, = plt.plot(t, s, lw=2)
-
-plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
- arrowprops=dict(facecolor='black', shrink=0.05),
- )
-
-plt.ylim(-2,2)
-plt.show()
Copied: trunk/matplotlib/doc/pyplots/pyplot_annotate.py (from rev 5512, trunk/matplotlib/doc/users/figures/pyplot_annotate.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/pyplot_annotate.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/pyplot_annotate.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,15 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+ax = plt.subplot(111)
+
+t = np.arange(0.0, 5.0, 0.01)
+s = np.cos(2*np.pi*t)
+line, = plt.plot(t, s, lw=2)
+
+plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
+ arrowprops=dict(facecolor='black', shrink=0.05),
+ )
+
+plt.ylim(-2,2)
+plt.show()
Deleted: trunk/matplotlib/doc/pyplots/pyplot_formatstr.py
===================================================================
--- trunk/matplotlib/doc/users/figures/pyplot_formatstr.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/pyplot_formatstr.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,5 +0,0 @@
-import matplotlib.pyplot as plt
-plt.plot([1,2,3,4], [1,4,9,16], 'ro')
-plt.axis([0, 6, 0, 20])
-
-
Copied: trunk/matplotlib/doc/pyplots/pyplot_formatstr.py (from rev 5512, trunk/matplotlib/doc/users/figures/pyplot_formatstr.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/pyplot_formatstr.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/pyplot_formatstr.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,5 @@
+import matplotlib.pyplot as plt
+plt.plot([1,2,3,4], [1,4,9,16], 'ro')
+plt.axis([0, 6, 0, 20])
+
+
Deleted: trunk/matplotlib/doc/pyplots/pyplot_mathtext.py
===================================================================
--- trunk/matplotlib/doc/users/figures/pyplot_mathtext.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/pyplot_mathtext.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,12 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-t = np.arange(0.0, 2.0, 0.01)
-s = np.sin(2*np.pi*t)
-
-plt.plot(t,s)
-plt.title(r'$\alpha_i > \beta_i$', fontsize=20)
-plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20)
-plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$',
- fontsize=20)
-plt.xlabel('time (s)')
-plt.ylabel('volts (mV)')
Copied: trunk/matplotlib/doc/pyplots/pyplot_mathtext.py (from rev 5512, trunk/matplotlib/doc/users/figures/pyplot_mathtext.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/pyplot_mathtext.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/pyplot_mathtext.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,12 @@
+import numpy as np
+import matplotlib.pyplot as plt
+t = np.arange(0.0, 2.0, 0.01)
+s = np.sin(2*np.pi*t)
+
+plt.plot(t,s)
+plt.title(r'$\alpha_i > \beta_i$', fontsize=20)
+plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20)
+plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$',
+ fontsize=20)
+plt.xlabel('time (s)')
+plt.ylabel('volts (mV)')
Deleted: trunk/matplotlib/doc/pyplots/pyplot_simple.py
===================================================================
--- trunk/matplotlib/doc/users/figures/pyplot_simple.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/pyplot_simple.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,4 +0,0 @@
-import matplotlib.pyplot as plt
-plt.plot([1,2,3])
-plt.ylabel('some numbers')
-plt.show()
Copied: trunk/matplotlib/doc/pyplots/pyplot_simple.py (from rev 5512, trunk/matplotlib/doc/users/figures/pyplot_simple.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/pyplot_simple.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/pyplot_simple.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,4 @@
+import matplotlib.pyplot as plt
+plt.plot([1,2,3])
+plt.ylabel('some numbers')
+plt.show()
Deleted: trunk/matplotlib/doc/pyplots/pyplot_text.py
===================================================================
--- trunk/matplotlib/doc/users/figures/pyplot_text.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/pyplot_text.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,17 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-mu, sigma = 100, 15
-x = mu + sigma * np.random.randn(10000)
-
-# the histogram of the data
-n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)
-
-
-plt.xlabel('Smarts')
-plt.ylabel('Probability')
-plt.title('Histogram of IQ')
-plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
-plt.axis([40, 160, 0, 0.03])
-plt.grid(True)
-
Copied: trunk/matplotlib/doc/pyplots/pyplot_text.py (from rev 5512, trunk/matplotlib/doc/users/figures/pyplot_text.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/pyplot_text.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/pyplot_text.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,17 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+mu, sigma = 100, 15
+x = mu + sigma * np.random.randn(10000)
+
+# the histogram of the data
+n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)
+
+
+plt.xlabel('Smarts')
+plt.ylabel('Probability')
+plt.title('Histogram of IQ')
+plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
+plt.axis([40, 160, 0, 0.03])
+plt.grid(True)
+
Deleted: trunk/matplotlib/doc/pyplots/pyplot_three.py
===================================================================
--- trunk/matplotlib/doc/users/figures/pyplot_three.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/pyplot_three.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,9 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-# evenly sampled time at 200ms intervals
-t = np.arange(0., 5., 0.2)
-
-# red dashes, blue squares and green triangles
-plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
-
Copied: trunk/matplotlib/doc/pyplots/pyplot_three.py (from rev 5512, trunk/matplotlib/doc/users/figures/pyplot_three.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/pyplot_three.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/pyplot_three.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,9 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+# evenly sampled time at 200ms intervals
+t = np.arange(0., 5., 0.2)
+
+# red dashes, blue squares and green triangles
+plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
+
Deleted: trunk/matplotlib/doc/pyplots/pyplot_two_subplots.py
===================================================================
--- trunk/matplotlib/doc/users/figures/pyplot_two_subplots.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/pyplot_two_subplots.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,16 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-def f(t):
- return np.exp(-t) * np.cos(2*np.pi*t)
-
-t1 = np.arange(0.0, 5.0, 0.1)
-t2 = np.arange(0.0, 5.0, 0.02)
-
-plt.figure(1)
-plt.subplot(211)
-plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
-
-plt.subplot(212)
-plt.plot(t2, np.cos(2*np.pi*t2), 'r--')
-
Copied: trunk/matplotlib/doc/pyplots/pyplot_two_subplots.py (from rev 5512, trunk/matplotlib/doc/users/figures/pyplot_two_subplots.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/pyplot_two_subplots.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/pyplot_two_subplots.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,16 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+def f(t):
+ return np.exp(-t) * np.cos(2*np.pi*t)
+
+t1 = np.arange(0.0, 5.0, 0.1)
+t2 = np.arange(0.0, 5.0, 0.02)
+
+plt.figure(1)
+plt.subplot(211)
+plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
+
+plt.subplot(212)
+plt.plot(t2, np.cos(2*np.pi*t2), 'r--')
+
Deleted: trunk/matplotlib/doc/pyplots/text_commands.py
===================================================================
--- trunk/matplotlib/doc/users/figures/text_commands.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/text_commands.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold')
-
-ax = fig.add_subplot(111)
-
-ax.set_title('axes title')
-
-ax.set_xlabel('xlabel')
-ax.set_ylabel('ylabel')
-
-ax.text(5, 8, 'boxed italics text in data coords', style='italic',
- bbox={'facecolor':'red', 'alpha':0.5, 'pad':10})
-
-ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=20)
-
-ax.text(4, 3, unicode('unicode: Institut f\374r Festk\366rperphysik', 'latin-1'))
-
-ax.text(0.95, 0.01, 'colored text in axes coords',
- verticalalignment='bottom', horizontalalignment='right',
- transform=ax.transAxes,
- color='green', fontsize=20)
-
-
-ax.plot([2], [1], 'o')
-ax.annotate('annotate', xy=(2, 1), xytext=(3, 4),
- arrowprops=dict(facecolor='black', shrink=0.05))
-
-ax.axis([0, 10, 0, 10])
-
-plt.show()
Copied: trunk/matplotlib/doc/pyplots/text_commands.py (from rev 5512, trunk/matplotlib/doc/users/figures/text_commands.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/text_commands.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/text_commands.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold')
+
+ax = fig.add_subplot(111)
+
+ax.set_title('axes title')
+
+ax.set_xlabel('xlabel')
+ax.set_ylabel('ylabel')
+
+ax.text(5, 8, 'boxed italics text in data coords', style='italic',
+ bbox={'facecolor':'red', 'alpha':0.5, 'pad':10})
+
+ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=20)
+
+ax.text(4, 3, unicode('unicode: Institut f\374r Festk\366rperphysik', 'latin-1'))
+
+ax.text(0.95, 0.01, 'colored text in axes coords',
+ verticalalignment='bottom', horizontalalignment='right',
+ transform=ax.transAxes,
+ color='green', fontsize=20)
+
+
+ax.plot([2], [1], 'o')
+ax.annotate('annotate', xy=(2, 1), xytext=(3, 4),
+ arrowprops=dict(facecolor='black', shrink=0.05))
+
+ax.axis([0, 10, 0, 10])
+
+plt.show()
Deleted: trunk/matplotlib/doc/pyplots/text_layout.py
===================================================================
--- trunk/matplotlib/doc/users/figures/text_layout.py 2008-06-13 14:57:50 UTC (rev 5507)
+++ trunk/matplotlib/doc/pyplots/text_layout.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -1,77 +0,0 @@
-import matplotlib.pyplot as plt
-import matplotlib.patches as patches
-
-# build a rectangle in axes coords
-left, width = .25, .5
-bottom, height = .25, .5
-right = left + width
-top = bottom + height
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-
-# axes coordinates are 0,0 is bottom left and 1,1 is upper right
-p = patches.Rectangle(
- (left, bottom), width, height,
- fill=False, transform=ax.transAxes, clip_on=False
- )
-
-ax.add_patch(p)
-
-ax.text(left, bottom, 'left top',
- horizontalalignment='left',
- verticalalignment='top',
- transform=ax.transAxes)
-
-ax.text(left, bottom, 'left bottom',
- horizontalalignment='left',
- verticalalignment='bottom',
- transform=ax.transAxes)
-
-ax.text(right, top, 'right bottom',
- horizontalalignment='right',
- verticalalignment='bottom',
- transform=ax.transAxes)
-
-ax.text(right, top, 'right top',
- horizontalalignment='right',
- verticalalignment='top',
- transform=ax.transAxes)
-
-ax.text(right, bottom, 'center top',
- horizontalalignment='center',
- verticalalignment='top',
- transform=ax.transAxes)
-
-ax.text(left, 0.5*(bottom+top), 'right center',
- horizontalalignment='right',
- verticalalignment='center',
- rotation='vertical',
- transform=ax.transAxes)
-
-ax.text(left, 0.5*(bottom+top), 'left center',
- horizontalalignment='left',
- verticalalignment='center',
- rotation='vertical',
- transform=ax.transAxes)
-
-ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle',
- horizontalalignment='center',
- verticalalignment='center',
- fontsize=20, color='red',
- transform=ax.transAxes)
-
-ax.text(right, 0.5*(bottom+top), 'centered',
- horizontalalignment='center',
- verticalalignment='center',
- rotation='vertical',
- transform=ax.transAxes)
-
-ax.text(left, top, 'rotated\nwith newlines',
- horizontalalignment='center',
- verticalalignment='center',
- rotation=45,
- transform=ax.transAxes)
-
-ax.set_axis_off()
-plt.show()
Copied: trunk/matplotlib/doc/pyplots/text_layout.py (from rev 5512, trunk/matplotlib/doc/users/figures/text_layout.py)
===================================================================
--- trunk/matplotlib/doc/pyplots/text_layout.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/text_layout.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -0,0 +1,77 @@
+import matplotlib.pyplot as plt
+import matplotlib.patches as patches
+
+# build a rectangle in axes coords
+left, width = .25, .5
+bottom, height = .25, .5
+right = left + width
+top = bottom + height
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+
+# axes coordinates are 0,0 is bottom left and 1,1 is upper right
+p = patches.Rectangle(
+ (left, bottom), width, height,
+ fill=False, transform=ax.transAxes, clip_on=False
+ )
+
+ax.add_patch(p)
+
+ax.text(left, bottom, 'left top',
+ horizontalalignment='left',
+ verticalalignment='top',
+ transform=ax.transAxes)
+
+ax.text(left, bottom, 'left bottom',
+ horizontalalignment='left',
+ verticalalignment='bottom',
+ transform=ax.transAxes)
+
+ax.text(right, top, 'right bottom',
+ horizontalalignment='right',
+ verticalalignment='bottom',
+ transform=ax.transAxes)
+
+ax.text(right, top, 'right top',
+ horizontalalignment='right',
+ verticalalignment='top',
+ transform=ax.transAxes)
+
+ax.text(right, bottom, 'center top',
+ horizontalalignment='center',
+ verticalalignment='top',
+ transform=ax.transAxes)
+
+ax.text(left, 0.5*(bottom+top), 'right center',
+ horizontalalignment='right',
+ verticalalignment='center',
+ rotation='vertical',
+ transform=ax.transAxes)
+
+ax.text(left, 0.5*(bottom+top), 'left center',
+ horizontalalignment='left',
+ verticalalignment='center',
+ rotation='vertical',
+ transform=ax.transAxes)
+
+ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle',
+ horizontalalignment='center',
+ verticalalignment='center',
+ fontsize=20, color='red',
+ transform=ax.transAxes)
+
+ax.text(right, 0.5*(bottom+top), 'centered',
+ horizontalalignment='center',
+ verticalalignment='center',
+ rotation='vertical',
+ transform=ax.transAxes)
+
+ax.text(left, top, 'rotated\nwith newlines',
+ horizontalalignment='center',
+ verticalalignment='center',
+ rotation=45,
+ transform=ax.transAxes)
+
+ax.set_axis_off()
+plt.show()
Modified: trunk/matplotlib/doc/sphinxext/plot_directive.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/plot_directive.py 2008-06-13 15:54:21 UTC (rev 5512)
+++ trunk/matplotlib/doc/sphinxext/plot_directive.py 2008-06-13 17:18:41 UTC (rev 5513)
@@ -13,8 +13,8 @@
source will be included inline, as well as a link to the source.
"""
+import sys, os, glob
from docutils.parsers.rst import directives
-import os.path
try:
# docutils 0.4
@@ -24,6 +24,14 @@
from docutils.parsers.rst.directives.images import Image
align = Image.align
+
+import matplotlib
+import IPython.Shell
+matplotlib.use('Agg')
+import matplotlib.pyplot as plt
+
+mplshell = IPython.Shell.MatplotlibShell('mpl')
+
options = {'alt': directives.unchanged,
'height': directives.length_or_unitless,
'width': directives.length_or_percentage_or_unitless,
@@ -35,40 +43,85 @@
template_no_source = """
.. htmlonly::
- .. image:: %(reference)s.png
- :target: %(reference)s.hires.png
+ .. image:: ../%(srcdir)s/%(basename)s.png
%(options)s
+ `[%(basename)s source py] `[%(basename)s highres png] <../%(srcdir)s/%(basename)s.hires.png>`_ `[%(basename)s pdf] <../%(srcdir)s/%(basename)s.pdf>`_
+
.. latexonly::
- .. image:: %(reference)s.pdf
+ .. image:: ../%(srcdir)s/%(basename)s.pdf
%(options)s
"""
template_source = """
-.. literalinclude:: %(reference)s.py
+.. literalinclude:: ../pyplots/%(reference)s
.. htmlonly::
- .. image:: %(reference)s.png
- :target: %(reference)s.hires.png
+ .. image:: ../%(srcdir)s/%(basename)s.png
%(options)s
- `[%(basename)s.py] <%(reference)s.py>`_
+ `[%(basename)s source py] <../%(srcdir)s/%(reference)s>`_ `[%(basename)s highres png] <../%(srcdir)s/%(basename)s.hires.png>`_ `[%(basename)s pdf] <../%(srcdir)s/%(basename)s.pdf>`_
.. latexonly::
- .. image:: %(reference)s.pdf
+ .. image:: ../%(srcdir)s/%(basename)s.pdf
%(options)s
"""
+def makefig(fullpath, outdir):
+ """
+ run a pyplot script and save the low and high res PNGs and a PDF in _static
+ """
+
+ fullpath = str(fullpath) # todo, why is unicode breaking this
+ formats = [('png', 100),
+ ('hires.png', 200),
+ ('pdf', 72)]
+
+ basedir, fname = os.path.split(fullpath)
+ basename, ext = os.path.splitext(fname)
+ all_exists = True
+
+ for format, dpi in formats:
+ outname = os.path.join(outdir, '%s.%s' % (basename, format))
+ if not os.path.exists(outname):
+ all_exists = False
+ break
+
+ if all_exists:
+ print ' already have %s'%fullpath
+ return
+
+ print ' building %s'%fullpath, type(fullpath)
+ plt.close('all') # we need to clear between runs
+
+ mplshell.magic_run(fullpath)
+ for format, dpi in formats:
+ #print 'saving', outdir, basename, format
+ outname = os.path.join(outdir, '%s.%s' % (basename, format))
+ plt.savefig(outname, dpi=dpi)
+ print ' all figures made'
+
def run(arguments, options, state_machine, lineno):
+ #print 'arguments', arguments
+ #print 'options', options
+
reference = directives.uri(arguments[0])
- print reference
- for ext in ('.py', '.png', '.pdf'):
- if reference.endswith(ext):
- reference = reference[:-len(ext)]
- break
+ basename, ext = os.path.splitext(reference)
+
+ # todo - should we be using the _static dir for the outdir, I am
+ # not sure we want to corrupt that dir with autogenerated files
+ # since it also has permanent files in it which makes it difficult
+ # to clean (save an rm -rf followed by and svn up)
+ srcdir = 'pyplots'
+
+ makefig(os.path.join(srcdir, reference), srcdir)
+
+ # todo: it is not great design to assume the makefile is putting
+ # the figs into the right place, so we may want to do that here instead.
+
if options.has_key('include-source'):
template = template_source
del options['include-source']
@@ -77,7 +130,7 @@
options = [' :%s: %s' % (key, val) for key, val in
options.items()]
options = "\n".join(options)
- basename = os.path.basename(reference)
+
lines = template % locals()
lines = lines.split('\n')
@@ -85,6 +138,7 @@
lines, state_machine.input_lines.source(0))
return []
+
try:
from docutils.parsers.rst import Directive
except ImportError:
Modified: trunk/matplotlib/doc/users/annotations.rst
===================================================================
--- trunk/matplotlib/doc/users/annotations.rst 2008-06-13 15:54:21 UTC (rev 5512)
+++ trunk/matplotlib/doc/users/annotations.rst 2008-06-13 17:18:41 UTC (rev 5513)
@@ -12,7 +12,7 @@
``xy`` and the location of the text ``xytext``. Both of these
arguments are ``(x,y)`` tuples.
-.. plot:: figures/annotation_basic.py
+.. plot:: annotation_basic.py
:include-source:
:scale: 75
@@ -72,7 +72,7 @@
``fontsize are passed from the `~matplotlib.Axes.annotate` to the
``Text`` instance
-.. plot:: figures/annotation_polar.py
+.. plot:: annotation_polar.py
:scale: 75
:include-source:
Modified: trunk/matplotlib/doc/users/artists.rst
===================================================================
--- trunk/matplotlib/doc/users/artists.rst 2008-06-13 15:54:21 UTC (rev 5512)
+++ trunk/matplotlib/doc/users/artists.rst 2008-06-13 17:18:41 UTC (rev 5513)
@@ -135,7 +135,7 @@
Try creating the figure below.
-.. plot:: figures/fig_axes_labels_simple
+.. plot:: fig_axes_labels_simple.py
:scale: 75
.. _customizing-artists:
@@ -326,7 +326,7 @@
In [195]: fig.canvas.draw()
-.. plot:: figures/fig_x
+.. plot:: fig_x.py
:scale: 75
@@ -604,7 +604,7 @@
Here is an example, not recommended for its beauty, which customizes
the axes and tick properties
-.. plot:: figures/fig_axes_customize_simple.py
+.. plot:: fig_axes_customize_simple.py
:scale: 75
:include-source:
@@ -642,6 +642,6 @@
Here is an example which sets the formatter for the upper ticks with
dollar signs and colors them green on the right side of the yaxis
-.. plot:: figures/dollar_ticks.py
+.. plot:: dollar_ticks.py
:scale: 75
:include-source:
Modified: trunk/matplotlib/doc/users/mathtext.rst
===================================================================
--- trunk/matplotlib/doc/users/mathtext.rst 2008-06-13 15:54:21 UTC (rev 5512)
+++ trunk/matplotlib/doc/users/mathtext.rst 2008-06-13 17:18:41 UTC (rev 5513)
@@ -271,7 +271,7 @@
Here is an example illustrating many of these features in context.
-.. plot:: figures/pyplot_mathtext.py
+.. plot:: pyplot_mathtext.py
:scale: 75
:include-source:
Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst
===================================================================
--- trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-06-13 15:54:21 UTC (rev 5512)
+++ trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-06-13 17:18:41 UTC (rev 5513)
@@ -12,7 +12,7 @@
keeps track of the current figure and plotting area, and the plotting
functions are directed to the current axes
-.. plot:: figures/pyplot_simple
+.. plot:: pyplot_simple.py
:scale: 75
:include-source:
@@ -37,7 +37,7 @@
The default format string is 'b-', which is a solid blue line. For
example, to plot the above with red circles, you would issue
-.. plot:: figures/pyplot_formatstr.py
+.. plot:: pyplot_formatstr.py
:scale: 75
:include-source:
@@ -54,7 +54,7 @@
plotting several lines with different format styles in one command
using arrays.
-.. plot:: figures/pyplot_three.py
+.. plot:: pyplot_three.py
:scale: 75
:include-source:
@@ -160,7 +160,7 @@
to worry about this, because it is all taken care of behind the
scenes. Below is an script to create two subplots.
-.. plot:: figures/pyplot_two_subplots.py
+.. plot:: pyplot_two_subplots.py
:scale: 75
:include-source:
@@ -220,7 +220,7 @@
are used tox add text in the indicated locations (see :ref:`text-intro`
for a more detailed example)
-.. plot:: figures/pyplot_text.py
+.. plot:: pyplot_text.py
:scale: 75
:include-source:
@@ -265,8 +265,8 @@
two points to consider: the location being annotated represented by
the argument ``xy`` and the location of the text ``xytext``. Both of
these arguments are ``(x,y)`` tuples.
-
-.. plot:: figures/pyplot_annotate.py
+
+.. plot:: pyplot_annotate.py
...
[truncated message content] |