Revision: 5233
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5233&view=rev
Author: jdh2358
Date: 2008-05-23 11:17:23 -0700 (Fri, 23 May 2008)
Log Message:
-----------
added the pyplot tutorial to the users guide
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/figures/dollar_ticks.py
trunk/matplotlib/doc/users_guide/figures/fig_axes_customize_simple.py
trunk/matplotlib/doc/users_guide/figures/fig_axes_labels_simple.py
trunk/matplotlib/doc/users_guide/figures/fig_x.py
trunk/matplotlib/doc/users_guide/figures/make.py
trunk/matplotlib/doc/users_guide/users_guide.txt
Added Paths:
-----------
trunk/matplotlib/doc/users_guide/figures/pyplot_formatstr.py
trunk/matplotlib/doc/users_guide/figures/pyplot_mathtext.py
trunk/matplotlib/doc/users_guide/figures/pyplot_simple.py
trunk/matplotlib/doc/users_guide/figures/pyplot_text.py
trunk/matplotlib/doc/users_guide/figures/pyplot_three.py
trunk/matplotlib/doc/users_guide/figures/pyplot_two_subplots.py
trunk/matplotlib/doc/users_guide/navigation_toolbar.txt
trunk/matplotlib/doc/users_guide/pyplot_tutorial.txt
Modified: trunk/matplotlib/doc/users_guide/figures/dollar_ticks.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/dollar_ticks.py 2008-05-23
18:05:27 UTC (rev 5232)
+++ trunk/matplotlib/doc/users_guide/figures/dollar_ticks.py 2008-05-23
18:17:23 UTC (rev 5233)
@@ -14,7 +14,4 @@
tick.label2On = True
tick.label2.set_color('green')
-fig.savefig('dollar_ticks')
-plt.show()
-
Modified: trunk/matplotlib/doc/users_guide/figures/fig_axes_customize_simple.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/fig_axes_customize_simple.py
2008-05-23 18:05:27 UTC (rev 5232)
+++ trunk/matplotlib/doc/users_guide/figures/fig_axes_customize_simple.py
2008-05-23 18:17:23 UTC (rev 5233)
@@ -24,6 +24,4 @@
line.set_markeredgewidth(3)
-fig.savefig('fig_axes_customize_simple')
-plt.show()
Modified: trunk/matplotlib/doc/users_guide/figures/fig_axes_labels_simple.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/fig_axes_labels_simple.py
2008-05-23 18:05:27 UTC (rev 5232)
+++ trunk/matplotlib/doc/users_guide/figures/fig_axes_labels_simple.py
2008-05-23 18:17:23 UTC (rev 5233)
@@ -16,6 +16,4 @@
facecolor='yellow', edgecolor='yellow')
ax2.set_xlabel('time (s)')
-fig.savefig('fig_axes_labels_simple')
-plt.show()
Modified: trunk/matplotlib/doc/users_guide/figures/fig_x.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/fig_x.py 2008-05-23 18:05:27 UTC
(rev 5232)
+++ trunk/matplotlib/doc/users_guide/figures/fig_x.py 2008-05-23 18:17:23 UTC
(rev 5233)
@@ -9,5 +9,4 @@
fig.lines.extend([l1, l2])
-fig.savefig('fig_x')
-plt.show()
+
Modified: trunk/matplotlib/doc/users_guide/figures/make.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/make.py 2008-05-23 18:05:27 UTC
(rev 5232)
+++ trunk/matplotlib/doc/users_guide/figures/make.py 2008-05-23 18:17:23 UTC
(rev 5233)
@@ -1,22 +1,33 @@
#!/usr/bin/env python
import sys, os, glob
import matplotlib
+import IPython.Shell
matplotlib.rcdefaults()
matplotlib.use('Agg')
+mplshell = IPython.Shell.MatplotlibShell('mpl')
+
def figs():
- # each one of these will make a figure when imported
- import dollar_ticks
- import fig_axes_customize_simple
- import fig_axes_labels_simple
- import fig_x
+ print 'making figs'
+ import matplotlib.pyplot as plt
+ for fname in glob.glob('*.py'):
+ if fname==__file__: continue
+ basename, ext = os.path.splitext(fname)
+ outfile = '%s.png'%basename
+ if os.path.exists(outfile):
+ print ' already have %s'%outfile
+ continue
+ else:
+ print ' building %s'%fname
+ plt.gcf().clf() # we need to clear between runs
+ mplshell.magic_run(basename)
+ plt.savefig('%s.png'%basename)
print 'all figures made'
- for fname in glob.glob('*.pyc'):
- os.remove(fname)
+
def clean():
- patterns = ['#*', '*~', '*.png']
+ patterns = ['#*', '*~', '*.png', '*pyc']
for pattern in patterns:
for fname in glob.glob(pattern):
os.remove(fname)
Added: trunk/matplotlib/doc/users_guide/figures/pyplot_formatstr.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/pyplot_formatstr.py
(rev 0)
+++ trunk/matplotlib/doc/users_guide/figures/pyplot_formatstr.py
2008-05-23 18:17:23 UTC (rev 5233)
@@ -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])
+
+
Added: trunk/matplotlib/doc/users_guide/figures/pyplot_mathtext.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/pyplot_mathtext.py
(rev 0)
+++ trunk/matplotlib/doc/users_guide/figures/pyplot_mathtext.py 2008-05-23
18:17:23 UTC (rev 5233)
@@ -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)')
Added: trunk/matplotlib/doc/users_guide/figures/pyplot_simple.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/pyplot_simple.py
(rev 0)
+++ trunk/matplotlib/doc/users_guide/figures/pyplot_simple.py 2008-05-23
18:17:23 UTC (rev 5233)
@@ -0,0 +1,4 @@
+import matplotlib.pyplot as plt
+plt.plot([1,2,3])
+plt.ylabel('some numbers')
+
Added: trunk/matplotlib/doc/users_guide/figures/pyplot_text.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/pyplot_text.py
(rev 0)
+++ trunk/matplotlib/doc/users_guide/figures/pyplot_text.py 2008-05-23
18:17:23 UTC (rev 5233)
@@ -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(85, .025, r'$\mu=100,\ \sigma=15$')
+plt.axis([40, 160, 0, 0.03])
+plt.grid(True)
+
Added: trunk/matplotlib/doc/users_guide/figures/pyplot_three.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/pyplot_three.py
(rev 0)
+++ trunk/matplotlib/doc/users_guide/figures/pyplot_three.py 2008-05-23
18:17:23 UTC (rev 5233)
@@ -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^')
+
Added: trunk/matplotlib/doc/users_guide/figures/pyplot_two_subplots.py
===================================================================
--- trunk/matplotlib/doc/users_guide/figures/pyplot_two_subplots.py
(rev 0)
+++ trunk/matplotlib/doc/users_guide/figures/pyplot_two_subplots.py
2008-05-23 18:17:23 UTC (rev 5233)
@@ -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--')
+
Added: trunk/matplotlib/doc/users_guide/navigation_toolbar.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/navigation_toolbar.txt
(rev 0)
+++ trunk/matplotlib/doc/users_guide/navigation_toolbar.txt 2008-05-23
18:17:23 UTC (rev 5233)
@@ -0,0 +1,112 @@
+Interactive navigation
+======================
+
+All figure windows come with a navigation toolbar, which can be used
+to navigate through the data set. Here is a description of each of
+the buttons at the bottom of the toolbar
+
+.. image:: ../../lib/matplotlib/mpl-data/images/home.png
+ :scale: 100
+
+.. image:: ../../lib/matplotlib/mpl-data/images/back.png
+ :scale: 100
+
+.. image:: ../../lib/matplotlib/mpl-data/images/forward.png
+ :scale: 100
+
+The ``Forward`` and ``Back`` buttons
+ These are akin to the web browser forward and back buttons. They
+ are used to navigate back and forth between previously defined
+ views. They have no meaning unless you have already navigated
+ somewhere else using the pan and zoom buttons. This is analogous
+ to trying to click ``Back`` on your web browser before visiting a
+ new page --nothing happens. ``Home`` always takes you to the
+ first, default view of your data. For ``Home``, ``Forward`` and
+ ``Back``, think web browser where data views are web pages. Use
+ the pan and zoom to rectangle to define new views.
+
+.. image:: ../../lib/matplotlib/mpl-data/images/move.png
+ :scale: 100
+
+The ``Pan/Zoom`` button
+ This button has two modes: pan and zoom. Click the toolbar button
+ to activate panning and zooming, then put your mouse somewhere
+ over an axes. Press the left mouse button and hold it to pan the
+ figure, dragging it to a new position. When you release it, the
+ data under the point where you pressed will be moved to the point
+ where you released. If you press 'x' or 'y' while panning the
+ motion will be contrained to the x or y axis, respectively. Press
+ the right mouse button to zoom, dragging it to a new position.
+ The x axis will be zoomed in proportionate to the rightward
+ movement and zoomed out proportionate to the leftward movement.
+ Ditto for the yaxis and up/down motions. The point under your
+ mouse when you begin the zoom remains stationary, allowing you to
+ zoom to an arbitrary point in the figure. You can use the
+ modifier keys 'x', 'y' or 'CONTROL' to constrain the zoom to the x
+ axes, the y axes, or aspect ratio preserve, respectively.
+
+.. image:: ../../lib/matplotlib/mpl-data/images/zoom_to_rect.png
+ :scale: 100
+
+The ``Zoom-to-rectangle`` button
+ Click this toolbar button to activate this mode. Put your mouse
+ somewhere over and axes and press the left mouse button. Drag the
+ mouse while holding the button to a new location and release. The
+ axes view limits will be zoomed to the rectangle you have defined.
+ There is also an experimental 'zoom out to rectangle' in this mode
+ with the right button, which will place your entire axes in the
+ region defined by the zoom out rectangle.
+
+.. image:: ../../lib/matplotlib/mpl-data/images/subplots.png
+ :scale: 100
+
+The ``Subplot-configuration`` button
+ Use this tool to configure the parameters of the subplot: the
+ left, right, top, bottom, space between the rows and space between
+ the columns.
+
+.. image:: ../../lib/matplotlib/mpl-data/images/filesave.png
+ :scale: 100
+
+The ``Save`` button
+ Click this button to launch a file save dialog. You can save
+ files with the following extensions: ``png``, ``ps``, ``eps``,
+ ``svg`` and ``pdf``.
+
+
+If you are using :mod:`matplotlib.pyplot` the toolbar will be created
+automatically for every figure. If you are writing your own user
+interface code, you can add the toolbar as a widget. The exact syntax
+depends on your UI, but we have examples for every supported UI in the
+``matplotlib/examples/user_interfaces`` directory. Here is some
+example code for GTK::
+
+
+ from matplotlib.figure import Figure
+ from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as
FigureCanvas
+ from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as
NavigationToolbar
+
+ win = gtk.Window()
+ win.connect("destroy", lambda x: gtk.main_quit())
+ win.set_default_size(400,300)
+ win.set_title("Embedding in GTK")
+
+ vbox = gtk.VBox()
+ win.add(vbox)
+
+ fig = Figure(figsize=(5,4), dpi=100)
+ ax = fig.add_subplot(111)
+ ax.plot([1,2,3])
+
+ canvas = FigureCanvas(fig) # a gtk.DrawingArea
+ vbox.pack_start(canvas)
+ toolbar = NavigationToolbar(canvas, win)
+ vbox.pack_start(toolbar, False, False)
+
+ win.show_all()
+ gtk.main()
+
+
+
+
+
Added: trunk/matplotlib/doc/users_guide/pyplot_tutorial.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/pyplot_tutorial.txt
(rev 0)
+++ trunk/matplotlib/doc/users_guide/pyplot_tutorial.txt 2008-05-23
18:17:23 UTC (rev 5233)
@@ -0,0 +1,342 @@
+****************************
+A matplotlib.pyplot tutorial
+****************************
+
+:mod:`matplotlib.pyplot` is a collection of functions that make
+matplotlib work like matlab. Each ``pyplot`` function makes some
+change to a figure: eg, create a figure, create a plotting area in a
+figure, plot some lines in a plotting area, decorate the plot with
+labels, etc.... :mod:`matplotlib.pyplot` is stateful, in that it
+keeps track of the current figure and plotting area, and the plotting
+functions are directed to the current axes
+
+.. literalinclude:: figures/pyplot_simple.py
+
+.. image:: figures/pyplot_simple.png
+ :scale: 50
+
+
+You may be wondering why the x-axis ranges from 0-3 and the y-axis
+from 1-4. If you provide a single list or array to the
+:func:`~matplotlib.pyplot.plot` command, matplotlib assumes it a
+sequence of y values, and automatically generates the x values for
+you. Since python ranges start with 0, the default x vector has the
+same length as y but starts with 0. Hence the x data are
+``[0,1,2,3]``.
+
+:func:`~matplotlib.pyplot.plot` is a versatile command, and will take
+an arbitrary number of arguments. For example, to plot x versus y,
+you can issue the command::
+
+ plt.plot([1,2,3,4], [1,4,9,16])
+
+For every x, y pair of arguments, there is a optional third argument
+which is the format string that indicates the color and line type of
+the plot. The letters and symbols of the format string are from
+matlab, and you concatenate a color string with a line style string.
+The default format string is 'b-', which is a solid blue line. For
+example, to plot the above with red circles, you would issue
+
+.. literalinclude:: figures/pyplot_formatstr.py
+
+.. image:: figures/pyplot_formatstr.png
+ :scale: 50
+
+See the :func:`~matplotlib.pyplot.plot` documentation for a complete
+list of line styles and format strings. The
+:func:`~matplotlib.pyplot.axis` command in the example above takes a
+list of ``[xmin, xmax, ymin, ymax]`` and specifies the viewport of the
+axes.
+
+If matplotlib were limited to working with lists, it would be fairly
+useless for numeric processing. Generally, you will use `numpy
+<http://numpy.scipy.org>`_ arrays. In fact, all sequences are
+converted to numpy arrays internally. The example below illustrates a
+plotting several lines with different format styles in one command
+using arrays.
+
+.. literalinclude:: figures/pyplot_three.py
+
+.. image:: figures/pyplot_three.png
+ :scale: 50
+
+
+
+Controlling line properties
+===========================
+
+Lines have many attributes that you can set: linewidth, dash style,
+antialiased, etc; see :class:`matplotlib.lines.Line2D`. There are
+several ways to set line properties
+
+* Use keyword args::
+
+ plt.plot(x, y, linewidth=2.0)
+
+
+* Use the setter methods of the ``Line2D`` instance. ``plot`` returns a list
+ of lines; eg ``line1, line2 = plot(x1,y1,x2,x2)``. Below I have only
+ one line so it is a list of length 1. I use tuple unpacking in the
+ ``line, = plot(x, y, 'o')`` to get the first element of the list::
+
+ line, = plt.plot(x, y, 'o')
+ line.set_antialiased(False) # turn off antialising
+
+* Use the :func:`~matplotlib.pyplot.setp` command. The example below
+ uses matlab handle graphics style command to set multiple properties
+ on a list of lines. ``setp`` works transparently with a list of objects
+ or a single object. You can either use python keyword arguments or
+ matlab-style string/value pairs::
+
+ lines = plt.plot(x1, y1, x2, y2)
+ # use keyword args
+ plt.setp(lines, color='r', linewidth=2.0)
+ # or matlab style string value pairs
+ plt.setp(lines, 'color', 'r', 'linewidth', 2.0)
+
+
+Here are the available :class:`matplotlib.lines.Line2D` properties.
+
+====================== ==================================================
+Property Value Type
+====================== ==================================================
+alpha float
+animated [True | False]
+antialiased or aa [True | False]
+clip_box a matplotlib.transform.Bbox instance
+clip_on [True | False]
+clip_path a Path instance and a Transform instance, a Patch
+color or c any matplotlib color
+contains the hit testing function
+dash_capstyle ['butt' | 'round' | 'projecting']
+dash_joinstyle ['miter' | 'round' | 'bevel']
+dashes sequence of on/off ink in points
+data (np.array xdata, np.array ydata)
+figure a matplotlib.figure.Figure instance
+label any string
+linestyle or ls [ '-' | '--' | '-.' | ':' | 'steps' | ...]
+linewidth or lw float value in points
+lod [True | False]
+marker [ '+' | ',' | '.' | '1' | '2' | '3' | '4'
+markeredgecolor or mec any matplotlib color
+markeredgewidth or mew float value in points
+markerfacecolor or mfc any matplotlib color
+markersize or ms float
+picker used in interactive line selection
+pickradius the line pick selection radius
+solid_capstyle ['butt' | 'round' | 'projecting']
+solid_joinstyle ['miter' | 'round' | 'bevel']
+transform a matplotlib.transforms.Transform instance
+visible [True | False]
+xdata np.array
+ydata np.array
+zorder any number
+====================== ==================================================
+
+To get a list of settable line properties, call the
+:func:`~matplotlib.pyplot.setp` function with a line or lines
+as argument
+
+.. sourcecode:: ipython
+
+ In [69]: lines = plot([1,2,3])
+
+ In [70]: setp(lines)
+ alpha: float
+ animated: [True | False]
+ antialiased or aa: [True | False]
+ ...snip
+
+Working with multiple figure and axes
+=====================================
+
+
+Matlab, and :mod:`~matplotlib.pyplot`, have the concept of the current
+figure and the current axes. All plotting commands apply to the
+current axes. The function :func:`~matplotlib.pyplot.gca` returns the
+current axes (a :class:`matplotlib.axes.Axes` instance), and
+:func:`~matplotlib.pyplot.gcf` returns the current figure
+(:class:`matplotlib.figure.Figure` instance). Normally, you don't have
+to worry about this, because it is all taken care of behind the
+scenes. Below is an script to create two subplots.
+
+.. literalinclude:: figures/pyplot_two_subplots.py
+
+.. image:: figures/pyplot_two_subplots.png
+ :scale: 50
+
+The :func:`~matplotlib.pyplot.figure` command here is optional because
+``figure(1)`` will be created by default, just as a ``subplot(111)``
+will be created by default if you don't manually specify an axes. The
+:func:`~matplotlib.pyplot.subplot` command specifies ``numrows,
+numcols, fignum`` where ``fignum`` ranges from 1 to
+``numrows*numcols``. The commas in the ``subplot command are optional
+if ``numrows*numcols<10``. So ``subplot(211)`` is identical to
+``subplot(2,1,1)``. You can create an arbitrary number of subplots
+and axes. If you want to place an axes manually, ie, not on a
+rectangular grid, use the :func:`~matplotlib.pyplot.axes` command,
+which allows you to specify the location as ``axes([left, bottom,
+width, height])`` where all values are in fractional (0 to 1)
+coordinates. See `axes_demo.py
+<http://matplotlib.sf.net/examples/axes_demo.py>`_ for an example of
+placing axes manually and `line_styles.py
+<http://matplotlib.sf.net/examples/line_styles.py>`_ for an example
+with lots-o-subplots.
+
+
+You can create multiple figures by using multiple
+:func:`~matplotlib.pyplot.figure` calls with an increasing figure
+number. Of course, each figure can contain as many axes and subplots
+as your heart desires::
+
+ import matplotlib.pyplot as plt
+ plt.figure(1) # the first figure
+ plt.plot([1,2,3])
+
+ plt.figure(2) # a second figure
+ plt.plot([4,5,6])
+
+ plt.figure(1) # figure 1 current
+ plt.title('Easy as 1,2,3') # figure 1 title
+
+You can clear the current figure with :func:`~matplotlib.pyplot.clf`
+and the current axes with :func:`~matplotlib.pyplot.cla`.
+
+Working with text
+=================
+
+The :func:`~matplotlib.pyplot.text` command can be used to add text in
+an arbitrary location, and the :func:`~matplotlib.pyplot.xlabel`,
+:func:`~matplotlib.pyplot.ylabel` and :func:`~matplotlib.pyplot.title`
+are used to add text in the indicated locations.
+
+.. literalinclude:: figures/pyplot_text.py
+
+.. image:: figures/pyplot_text.png
+ :scale: 50
+
+
+All of the text commands The :func:`~matplotlib.pyplot.text` commands
+return an :class:`matplotlib.text.Text` instance. Just as with with
+lines above, you can customize the properties by passing keyword
+arguments into the text functions or using
+:func:`~matplotlib.pyplot.setp`::
+
+ t = plt.xlabel('my data', fontsize=14, color='red')
+
+The following font properties can be set
+
+==========================
==============================================================================
+Property Value Type
+==========================
==============================================================================
+alpha float
+backgroundcolor any matplotlib color
+bbox rectangle prop dict plus key 'pad' which is a pad
in points
+clip_box a matplotlib.transform.Bbox instance
+clip_on [True | False]
+clip_path a Path instance and a Transform instance, a Patch
+color any matplotlib color
+family [ 'serif' | 'sans-serif' | 'cursive' | 'fantasy' |
'monospace' ]
+fontproperties a matplotlib.font_manager.FontProperties instance
+horizontalalignment or ha [ 'center' | 'right' | 'left' ]
+label any string
+linespacing float
+multialignment ['left' | 'right' | 'center' ]
+name or fontname string eg, ['Sans' | 'Courier' | 'Helvetica' ...]
+picker [None|float|boolean|callable]
+position (x,y)
+rotation [ angle in degrees 'vertical' | 'horizontal'
+size or fontsize [ size in points | relative size eg 'smaller',
'x-large' ]
+style or fontstyle [ 'normal' | 'italic' | 'oblique']
+text string or anything printable with '%s' conversion
+transform a matplotlib.transform transformation instance
+variant [ 'normal' | 'small-caps' ]
+verticalalignment or va [ 'center' | 'top' | 'bottom' | 'baseline' ]
+visible [True | False]
+weight or fontweight [ 'normal' | 'bold' | 'heavy' | 'light' |
'ultrabold' | 'ultralight']
+x float
+y float
+zorder any number
+==========================
==============================================================================
+
+
+See `align_text <http://matplotlib.sf.net/screenshots.html#align_text>`_ for
+examples of how to control the alignment and orientation of text.
+
+
+
+
+Writing mathematical expressions
+================================
+
+You may have noticed in the histogram example above that we slipped a
+little TeX markup into the expression ``r'$\mu=100,\ \sigma=15$')``
+You can use TeX markup in any matplotlib text string; see the
+:mod:`matplotlib.mathtext` module documentation for details. Note
+that you do not need to have TeX installed, since matplotlib ships
+its own TeX expression parser, layout engine and fonts. Michael
+Droettboom has implemented the Knuth layout algorithms in python, so
+the quality is quite good (matplotlib also provides a ``usetex`` option
+for those who do want to call out to TeX to generate their text).
+
+Any text element can use math text. You need to use raw strings
+(preceed the quotes with an ``'r'``), and surround the string text
+with dollar signs, as in TeX. Regular text and mathtext can be
+interleaved within the same string. Mathtext can use the Bakoma
+Computer Modern fonts, STIX fonts or a Unicode font that you provide.
+The mathtext font can be selected with the customization variable
+``mathtext.fontset``::
+
+ # plain text
+ plt.title('alpha > beta')
+
+ # math text
+ plt.title(r'$\alpha > \beta$')
+
+
+To make subscripts and superscripts use the '_' and '^' symbols::
+
+ plt.title(r'$\alpha_i > \beta_i$')
+
+You can also use a large number of the TeX symbols, as in ``\infty,
+\leftarrow, \sum, \int``; see :class:`matplotlib.mathtext` for a
+complete list. The over/under subscript/superscript style is also
+supported. To write the sum of x_i from 0 to infinity, you could do::
+
+ plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$')
+
+The default font is *italics* for mathematical symbols. To change
+fonts, eg, to write "sin" in a Roman font, enclose the text in a font
+command::
+
+ plt.text(1,2, r's(t) = $\mathcal{A}\mathrm{sin}(2 \omega t)$')
+
+
+Even better, many commonly used function names that are typeset in a
+Roman font have shortcuts. So the expression above could be written
+as follows::
+
+ plt.text(1,2, r's(t) = $\mathcal{A}\sin(2 \omega t)$')
+
+
+Here "s" and "t" are variable in italics font (default), "sin" is in
+Roman font, and the amplitude "A" is in caligraphy font. The font
+choices are Roman ``\mathrm``, italics ``\mathit``, caligraphy
+``\mathcal``, and typewriter ``\mathtt``. If using the STIX fonts,
+you also have the choice of blackboard (double-struck) ``\mathbb``,
+circled ``\mathcircled``, Fraktur ``\mathfrak``, script (cursive)
+``\mathscr`` and sans-serif ``\mathsf``.
+
+The following accents are provided: ``\hat``, ``\breve``, ``\grave``,
+``\bar``, ``\acute``, ``\tilde``, ``\vec``, ``\dot``, ``\ddot``. All
+of them have the same syntax, eg to make an overbar you do ``\bar{o}``
+or to make an o umlaut you do ``\ddot{o}``.
+
+.. literalinclude:: figures/pyplot_mathtext.py
+
+.. image:: figures/pyplot_mathtext.png
+ :scale: 50
+
+
+
+
\ No newline at end of file
Modified: trunk/matplotlib/doc/users_guide/users_guide.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/users_guide.txt 2008-05-23 18:05:27 UTC
(rev 5232)
+++ trunk/matplotlib/doc/users_guide/users_guide.txt 2008-05-23 18:17:23 UTC
(rev 5233)
@@ -8,5 +8,8 @@
:maxdepth: 3
introduction
+ pyplot_tutorial
+ navigation_toolbar
+ customizing
artist_api_tut
event_handling_tut
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins