You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
| 2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
| 2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
| 2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jd...@us...> - 2008-05-23 18:59:33
|
Revision: 5236
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5236&view=rev
Author: jdh2358
Date: 2008-05-23 11:59:09 -0700 (Fri, 23 May 2008)
Log Message:
-----------
experimenting with including api docs
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/artist_api_tut.txt
trunk/matplotlib/doc/users_guide/index.txt
trunk/matplotlib/doc/users_guide/introduction.txt
trunk/matplotlib/doc/users_guide/users_guide.txt
Modified: trunk/matplotlib/doc/users_guide/artist_api_tut.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 18:30:51 UTC (rev 5235)
+++ trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 18:59:09 UTC (rev 5236)
@@ -1,4 +1,4 @@
-**************
+***************
Artist tutorial
***************
Modified: trunk/matplotlib/doc/users_guide/index.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/index.txt 2008-05-23 18:30:51 UTC (rev 5235)
+++ trunk/matplotlib/doc/users_guide/index.txt 2008-05-23 18:59:09 UTC (rev 5236)
@@ -12,3 +12,4 @@
users_guide
developers_guide
+ api
\ No newline at end of file
Modified: trunk/matplotlib/doc/users_guide/introduction.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/introduction.txt 2008-05-23 18:30:51 UTC (rev 5235)
+++ trunk/matplotlib/doc/users_guide/introduction.txt 2008-05-23 18:59:09 UTC (rev 5236)
@@ -4,8 +4,8 @@
matplotlib is a library for making 2D plots of arrays in `Python
<http://www.python.org>`_. Although it has its origins in emulating
-the `MATLAB™ <http://www.mathworks.com>`_ graphics commands, it does
-not require MATLAB™, and can be used in a Pythonic, object oriented
+the `Matlab (TM) <http://www.mathworks.com>`_ graphics commands, it does
+not require MATLAB (TM), and can be used in a Pythonic, object oriented
way. Although matplotlib is written primarily in pure Python, it
makes heavy use of `NumPy <http://www.numpy.org>`_ and other extension
code to provide good performance even for large arrays.
@@ -16,13 +16,13 @@
instantiate objects, call methods, set properties, and so on; it
should just work.
-For years, I used to use MATLAB™ exclusively for data analysis and
-visualization. MATLAB™ excels at making nice looking plots easy. When
+For years, I used to use MATLAB exclusively for data analysis and
+visualization. Matlab excels at making nice looking plots easy. When
I began working with EEG data, I found that I needed to write
applications to interact with my data, and developed and EEG analysis
-application in MATLAB™. As the application grew in complexity,
+application in Matlab. As the application grew in complexity,
interacting with databases, http servers, manipulating complex data
-structures, I began to strain against the limitations of MATLAB™ as a
+structures, I began to strain against the limitations of Matlab as a
programming language, and decided to start over in Python. Python
more than makes up for all of matlab's deficiencies as a programming
language, but I was having difficulty finding a 2D plotting package
@@ -47,9 +47,9 @@
Finding no package that suited me just right, I did what any
self-respecting Python programmer would do: rolled up my sleeves and
dived in. Not having any real experience with computer graphics, I
-decided to emulate MATLAB™'s plotting capabilities because that is
-something MATLAB™ does very well. This had the added advantage that
-many people have a lot of MATLAB™ experience, and thus they can
+decided to emulate Matlab's plotting capabilities because that is
+something Matlab does very well. This had the added advantage that
+many people have a lot of Matlab experience, and thus they can
quickly get up to steam plotting in python. From a developer's
perspective, having a fixed user interface (the pylab interface) has
been very useful, because the guts of the code base can be redesigned
@@ -58,7 +58,7 @@
The matplotlib code is conceptually divided into three parts: the
*pylab interface* is the set of functions provided by
:mod:`matplotlib.pylab` which allow the user to create plots with code
-quite similar to MATLAB™ figure generating code. The *matplotlib
+quite similar to Matlab figure generating code. The *matplotlib
frontend* or *matplotlib API* is the set of classes that do the heavy
lifting, creating and managing figures, text, lines, plots and so on.
This is an abstract interface that knows nothing about output. The
@@ -77,17 +77,12 @@
<http://docs.python.org/lib/module-Tkinter.html>`_ etc.
matplotlib is used by many people in many different contexts. Some
-people want to automatically generate PostScript® files to send to a
-printer or publishers. Others deploy matplotlib on a web application
-server to generate PNG output for inclusion in dynamically-generated
-web pages. Some use matplotlib interactively from the Python shell in
-Tkinter on Windows®. My primary use is to embed matplotlib in a Gtk+
-EEG application that runs on Windows, Linux and Macintosh OS X.
+people want to automatically generate PostScript® files to send
+to a printer or publishers. Others deploy matplotlib on a web
+application server to generate PNG output for inclusion in
+dynamically-generated web pages. Some use matplotlib interactively
+from the Python shell in Tkinter on Windows (TM) My primary use is to
+embed matplotlib in a Gtk+ EEG application that runs on Windows, Linux
+and Macintosh OS X.
-Because there are so many ways people want to use a plotting library,
-there is a certain amount of complexity inherent in configuring the
-library so that it will work naturally the way you want it to. Before
-diving into these details, let's first explore matplotlib's simplicity
-by comparing a typical matplotlib script with its analog in MATLAB™.
---- JDH
Modified: trunk/matplotlib/doc/users_guide/users_guide.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/users_guide.txt 2008-05-23 18:30:51 UTC (rev 5235)
+++ trunk/matplotlib/doc/users_guide/users_guide.txt 2008-05-23 18:59:09 UTC (rev 5236)
@@ -13,3 +13,4 @@
customizing
artist_api_tut
event_handling_tut
+
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-23 18:30:52
|
Revision: 5235
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5235&view=rev
Author: jdh2358
Date: 2008-05-23 11:30:51 -0700 (Fri, 23 May 2008)
Log Message:
-----------
added the pyplot tutorial to the users guide
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/artist_api_tut.txt
Modified: trunk/matplotlib/doc/users_guide/artist_api_tut.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 18:29:43 UTC (rev 5234)
+++ trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 18:30:51 UTC (rev 5235)
@@ -1,4 +1,4 @@
-***************
+**************
Artist tutorial
***************
@@ -455,8 +455,8 @@
yaxis matplotlib.axis.YAxis instance
============== ======================================
-The Axis containers
--------------------
+Axis containers
+---------------
The matplotlib.axis.Axis instances handle the drawing of the tick lines, the grid
lines, the tick labels and the axis label. You can configure the left
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-23 18:29:44
|
Revision: 5234
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5234&view=rev
Author: jdh2358
Date: 2008-05-23 11:29:43 -0700 (Fri, 23 May 2008)
Log Message:
-----------
added the pyplot tutorial to the users guide
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/artist_api_tut.txt
trunk/matplotlib/doc/users_guide/pyplot_tutorial.txt
Modified: trunk/matplotlib/doc/users_guide/artist_api_tut.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 18:17:23 UTC (rev 5233)
+++ trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 18:29:43 UTC (rev 5234)
@@ -1,6 +1,6 @@
-**********************************
-The matplotlib Artist API tutorial
-**********************************
+***************
+Artist tutorial
+***************
There are three layers to the matplotlib API. The FigureCanvas is the
area onto which the figure is drawn, the Renderer is the object which
@@ -198,8 +198,8 @@
at http://matplotlib.sourceforge.net/api.pdf for a listing of
properties for a give object.
-Getting at the objects to customize them
-========================================
+Object containers
+=================
Now that we know how to inspect set the properties of a given
object we want to configure, we need to now how to get at that
@@ -213,8 +213,8 @@
section we'll review where the various container objects store the
Artists that you want to get at.
-The Figure container
---------------------
+Figure container
+----------------
The top level container Artist is the matplotlib.figure.Figure, and it
contains everything in the figure. The background of the figure is a
@@ -263,9 +263,11 @@
In [191]: fig = plt.figure()
- In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
+ In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1],
+ transform=fig.transFigure, figure=fig)
- In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
+ In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0],
+ transform=fig.transFigure, figure=fig)
In [194]: fig.lines.extend([l1, l2])
@@ -290,8 +292,8 @@
================ ===============================================================
-The Axes container
-------------------
+Axes container
+--------------
The matplotlib.axes.Axes is the center of the matplotlib universe --
it contains the vast majority of all the Artists used in a figure with
@@ -523,47 +525,19 @@
grid Turn the grid on or off for the major or minor ticks
====================== =========================================================
-Try creating the figure below
+Here is an example, not recommended for its beauty, which customizes
+the axes and tick properties
+.. literalinclude:: figures/fig_axes_customize_simple.py
+
.. image:: figures/fig_axes_customize_simple.png
:scale: 75
-Exercise solution::
- 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')
+Tick containers
+---------------
- 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)
-
- fig.savefig('figures/fig_axes_customize_simple.png', dpi=150)
- fig.savefig('figures/fig_axes_customize_simple.eps')
- plt.show()
-
-
-
-The Tick containers
--------------------
-
The matplotlib.axis.Tick is the final container object in our descent
from the Figure to the Axes to the Axis to the Tick. The Tick
contains the tick and grid line instances, as well as the label
@@ -588,26 +562,9 @@
============== ==========================================================
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::
+dollar signs and colors them green on the right side of the yaxis
- import numpy as np
- import matplotlib.pyplot as plt
- import matplotlib.ticker as ticker
+.. literalinclude:: figures/dollar_ticks.py
- 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')
-
- plt.show()
-
-
.. image:: figures/dollar_ticks.png
:scale: 75
Modified: trunk/matplotlib/doc/users_guide/pyplot_tutorial.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/pyplot_tutorial.txt 2008-05-23 18:17:23 UTC (rev 5233)
+++ trunk/matplotlib/doc/users_guide/pyplot_tutorial.txt 2008-05-23 18:29:43 UTC (rev 5234)
@@ -1,6 +1,6 @@
-****************************
-A matplotlib.pyplot tutorial
-****************************
+***************
+pyplot tutorial
+***************
:mod:`matplotlib.pyplot` is a collection of functions that make
matplotlib work like matlab. Each ``pyplot`` function makes some
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-23 18:17:31
|
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.
|
|
From: <md...@us...> - 2008-05-23 18:06:37
|
Revision: 5232
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5232&view=rev
Author: mdboom
Date: 2008-05-23 11:05:27 -0700 (Fri, 23 May 2008)
Log Message:
-----------
Fix reST formatting in Axes.plot (as an opportunity to play with Darren's cool new toy)
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-05-23 17:41:58 UTC (rev 5231)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-05-23 18:05:27 UTC (rev 5232)
@@ -2723,85 +2723,85 @@
def plot(self, *args, **kwargs):
"""
Plot lines and/or markers to the Axes. ``*args`` is a variable length
- argument, allowing for multiple x,y pairs with an optional format
- string. For example, each of the following is legal
+ argument, allowing for multiple *x*, *y* pairs with an optional format
+ string. For example, each of the following is legal::
- plot(x,y) # plot x and y using the default line style and color
- plot(x,y, 'bo') # plot x and y using blue circle markers
+ plot(x, y) # plot x and y using the default line style and color
+ plot(x, y, 'bo') # plot x and y using blue circle markers
plot(y) # plot y using x as index array 0..N-1
plot(y, 'r+') # ditto, but with red plusses
- If x and/or y is 2-Dimensional, then the corresponding columns
+ If ``x`` and/or ``y`` is 2-dimensional, then the corresponding columns
will be plotted.
- An arbitrary number of x, y, fmt groups can be specified, as in
+ An arbitrary number of ``x``, ``y``, ``fmt`` groups can be specified, as in::
- a.plot(x1, y1, 'g^', x2, y2, 'g-')
+ a.plot(x1, y1, 'g^', x2, y2, 'g-')
Return value is a list of lines that were added.
- The following line styles are supported:
+ The following line styles are supported::
- * - : solid line
- * -- : dashed line
- * -. : dash-dot line
- * : : dotted line
- * . : points
- * , : pixels
- * o : circle symbols
- * ^ : triangle up symbols
- * v : triangle down symbols
- * < : triangle left symbols
- * > : triangle right symbols
- * s : square symbols
- * + : plus symbols
- * x : cross symbols
- * D : diamond symbols
- * d : thin diamond symbols
- * 1 : tripod down symbols
- * 2 : tripod up symbols
- * 3 : tripod left symbols
- * 4 : tripod right symbols
- * h : hexagon symbols
- * H : rotated hexagon symbols
- * p : pentagon symbols
- * | : vertical line symbols
- * _ : horizontal line symbols
- * steps : use gnuplot style 'steps' # kwarg only
+ - # solid line
+ -- # dashed line
+ -. # dash-dot line
+ : # dotted line
+ . # points
+ , # pixels
+ o # circle symbols
+ ^ # triangle up symbols
+ v # triangle down symbols
+ < # triangle left symbols
+ > # triangle right symbols
+ s # square symbols
+ + # plus symbols
+ x # cross symbols
+ D # diamond symbols
+ d # thin diamond symbols
+ 1 # tripod down symbols
+ 2 # tripod up symbols
+ 3 # tripod left symbols
+ 4 # tripod right symbols
+ h # hexagon symbols
+ H # rotated hexagon symbols
+ p # pentagon symbols
+ | # vertical line symbols
+ _ # horizontal line symbols
+ steps # use gnuplot style 'steps' # kwarg only
- The following color abbreviations are supported
+ The following color abbreviations are supported::
- b : blue
- g : green
- r : red
- c : cyan
- m : magenta
- y : yellow
- k : black
- w : white
+ b # blue
+ g # green
+ r # red
+ c # cyan
+ m # magenta
+ y # yellow
+ k # black
+ w # white
In addition, you can specify colors in many weird and
- wonderful ways, including full names 'green', hex strings
- '#008000', RGB or RGBA tuples (0,1,0,1) or grayscale
- intensities as a string '0.8'. Of these, the string
- specifications can be used in place of a fmt group, but the
- tuple forms can be used only as kwargs.
+ wonderful ways, including full names (``'green'``), hex strings
+ (``'#008000'``), RGB or RGBA tuples (``(0,1,0,1)``) or grayscale
+ intensities as a string (``'0.8'``). Of these, the string
+ specifications can be used in place of a ``fmt`` group, but the
+ tuple forms can be used only as ``kwargs``.
Line styles and colors are combined in a single format string, as in
- 'bo' for blue circles.
+ ``'bo'`` for blue circles.
The ``**kwargs`` can be used to set line properties (any property that has
a ``set_*`` method). You can use this to set a line label (for auto
legends), linewidth, anitialising, marker face color, etc. Here is an
- example:
+ example::
plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
plot([1,2,3], [1,4,9], 'rs', label='line 2')
axis([0, 4, 0, 10])
legend()
- If you make multiple lines with one plot command, the kwargs apply
- to all those lines, eg
+ If you make multiple lines with one plot command, the ``kwargs`` apply
+ to all those lines, e.g.::
plot(x1, y1, x2, y2, antialised=False)
@@ -2810,10 +2810,9 @@
The kwargs are Line2D properties:
%(Line2D)s
- kwargs scalex and scaley, if defined, are passed on
- to autoscale_view to determine whether the x and y axes are
- autoscaled; default True. See Axes.autoscale_view for more
- information
+ kwargs ``scalex`` and ``scaley``, if defined, are passed on to
+ :meth:`autoscale_view` to determine whether the *x* and *y* axes
+ are autoscaled; the default is ``True``.
"""
scalex = kwargs.pop( 'scalex', True)
scaley = kwargs.pop( 'scaley', True)
@@ -5493,7 +5492,7 @@
n, bins = np.histogram(x, bins, range=None,
normed=bool(normed), new=True)
n = [n,]
-
+
if cumulative:
if normed:
n = [(m * np.diff(bins)).cumsum() for m in n]
@@ -5577,7 +5576,7 @@
patches.append( self.fill(x,y) )
else:
raise ValueError, 'invalid histtype: %s' % histtype
-
+
for patch in patches:
for p in patch:
p.update(kwargs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-23 17:42:04
|
Revision: 5231
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5231&view=rev
Author: mdboom
Date: 2008-05-23 10:41:58 -0700 (Fri, 23 May 2008)
Log Message:
-----------
Add some hyperlinks. Clean up formatting.
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/introduction.txt
Modified: trunk/matplotlib/doc/users_guide/introduction.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/introduction.txt 2008-05-23 17:41:36 UTC (rev 5230)
+++ trunk/matplotlib/doc/users_guide/introduction.txt 2008-05-23 17:41:58 UTC (rev 5231)
@@ -2,17 +2,18 @@
Introduction
************
-matplotlib is a library for making 2D plots of arrays in python.
-Although it has its origins in emulating the MATLAB™ graphics
-commands, it does not require MATLAB™, and can be used in a pythonic,
-object oriented way. Although matplotlib is written primarily in pure
-python, it makes heavy use of NumPy and other extension
+matplotlib is a library for making 2D plots of arrays in `Python
+<http://www.python.org>`_. Although it has its origins in emulating
+the `MATLAB™ <http://www.mathworks.com>`_ graphics commands, it does
+not require MATLAB™, and can be used in a Pythonic, object oriented
+way. Although matplotlib is written primarily in pure Python, it
+makes heavy use of `NumPy <http://www.numpy.org>`_ and other extension
code to provide good performance even for large arrays.
matplotlib is designed with the philosophy that you should be able to
create simple plots with just a few commands, or just one! If you
want to see a histogram of your data, you shouldn't need to
-instantiate objects, call methods, set properties, and so it; it
+instantiate objects, call methods, set properties, and so on; it
should just work.
For years, I used to use MATLAB™ exclusively for data analysis and
@@ -22,67 +23,71 @@
application in MATLAB™. As the application grew in complexity,
interacting with databases, http servers, manipulating complex data
structures, I began to strain against the limitations of MATLAB™ as a
-programming language, and decided to start over in python. python
+programming language, and decided to start over in Python. Python
more than makes up for all of matlab's deficiencies as a programming
language, but I was having difficulty finding a 2D plotting package
-(for 3D VTK more than exceeds all of my needs).
+(for 3D `VTK <http://www.vtk.org/>`_) more than exceeds all of my needs).
-When I went searching for a python plotting package, I had several
+When I went searching for a Python plotting package, I had several
requirements:
* Plots should look great - publication quality. One important
- requirement for me is that the text looks good (antialiased, etc)
+ requirement for me is that the text looks good (antialiased, etc.)
* Postscript output for inclusion with TeX documents
-
+
* Embeddable in a graphical user interface for application
development
-
+
* Code should be easy enough that I can understand it and extend
- it.
+ it
-* Making plots should be easy.
+* Making plots should be easy
Finding no package that suited me just right, I did what any
-self-respecting python programmer would do: rolled up my sleeves and
+self-respecting Python programmer would do: rolled up my sleeves and
dived in. Not having any real experience with computer graphics, I
decided to emulate MATLAB™'s plotting capabilities because that is
something MATLAB™ does very well. This had the added advantage that
-many people have a lot of MATLAB™ experience, and thus they can quickly
-get up to steam plotting in python. From a developer's perspective,
-having a fixed user interface (the pylab interface) has
+many people have a lot of MATLAB™ experience, and thus they can
+quickly get up to steam plotting in python. From a developer's
+perspective, having a fixed user interface (the pylab interface) has
been very useful, because the guts of the code base can be redesigned
without affecting user code.
The matplotlib code is conceptually divided into three parts: the
*pylab interface* is the set of functions provided by
-:mod:`matplotlib.pylab` which allow the user to create plots with
-code quite similar to MATLAB™ figure generating code. The
-*matplotlib frontend* or *matplotlib API* is the set of
-classes that do the heavy lifting, creating and managing figures, text,
-lines, plots and so on. This is an abstract interface that knows
-nothing about output. The *backends* are device dependent
-drawing devices, aka renderers, that transform the frontend
-representation to hardcopy or a display device. Example backends: PS
-creates postscript hardcopy, SVG creates scalar vector graphics
-hardcopy, Agg creates PNG output using the high quality antigrain
-library that ships with matplotlib --- http://antigrain.com, GTK
-embeds matplotlib in a GTK application, GTKAgg uses the antigrain
-renderer to create a figure and embed it a GTK application, and so on
-for WX, Tkinter, FLTK...
+:mod:`matplotlib.pylab` which allow the user to create plots with code
+quite similar to MATLAB™ figure generating code. The *matplotlib
+frontend* or *matplotlib API* is the set of classes that do the heavy
+lifting, creating and managing figures, text, lines, plots and so on.
+This is an abstract interface that knows nothing about output. The
+*backends* are device dependent drawing devices, aka renderers, that
+transform the frontend representation to hardcopy or a display device.
+Example backends: PS creates `PostScript®
+<http://http://www.adobe.com/products/postscript/>`_ hardcopy, SVG
+creates `Scalable Vector Graphics <http://www.w3.org/Graphics/SVG/>`_
+hardcopy, Agg creates PNG output using the high quality `Anti-Grain
+Geometry <http://www.antigrain.com>`_ library that ships with
+matplotlib, GTK embeds matplotlib in a `Gtk+ <http://www.gtk.org/>`_
+application, GTKAgg uses the Anti-Grain renderer to create a figure
+and embed it a Gtk+ application, and so on for `PDF
+<http://www.adobe.com/products/acrobat/adobepdf.html>`_, `WxWidgets
+<http://www.wxpython.org/>`_, `Tkinter
+<http://docs.python.org/lib/module-Tkinter.html>`_ etc.
matplotlib is used by many people in many different contexts. Some
-people want to automatically generate postscript files to send to a
+people want to automatically generate PostScript® files to send to a
printer or publishers. Others deploy matplotlib on a web application
-server to generate PNG output for inclusion in dynamically generated
-web pages. Some use matplotlib interactively from the python shell in
-Tkinter on windows. My primary use is to embed matplotlib in a GTK
-EEG application that runs on windows, linux and OS X.
+server to generate PNG output for inclusion in dynamically-generated
+web pages. Some use matplotlib interactively from the Python shell in
+Tkinter on Windows®. My primary use is to embed matplotlib in a Gtk+
+EEG application that runs on Windows, Linux and Macintosh OS X.
Because there are so many ways people want to use a plotting library,
there is a certain amount of complexity inherent in configuring the
-library so that it will work naturally the way you want it to. Before
-diving into these details, let's first explore matplotlib's simplicity
+library so that it will work naturally the way you want it to. Before
+diving into these details, let's first explore matplotlib's simplicity
by comparing a typical matplotlib script with its analog in MATLAB™.
---- JDH
\ No newline at end of file
+--- JDH
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-23 17:41:45
|
Revision: 5230
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5230&view=rev
Author: mdboom
Date: 2008-05-23 10:41:36 -0700 (Fri, 23 May 2008)
Log Message:
-----------
Move examples from pylab to api.
Added Paths:
-----------
trunk/matplotlib/examples/api/custom_projection_example.py
trunk/matplotlib/examples/api/custom_scale_example.py
Removed Paths:
-------------
trunk/matplotlib/examples/pylab/custom_projection_example.py
trunk/matplotlib/examples/pylab/custom_scale_example.py
Copied: trunk/matplotlib/examples/api/custom_projection_example.py (from rev 5226, trunk/matplotlib/examples/pylab/custom_projection_example.py)
===================================================================
--- trunk/matplotlib/examples/api/custom_projection_example.py (rev 0)
+++ trunk/matplotlib/examples/api/custom_projection_example.py 2008-05-23 17:41:36 UTC (rev 5230)
@@ -0,0 +1,475 @@
+from matplotlib.axes import Axes
+from matplotlib import cbook
+from matplotlib.patches import Circle
+from matplotlib.path import Path
+from matplotlib.ticker import Formatter, Locator, NullLocator, FixedLocator, NullFormatter
+from matplotlib.transforms import Affine2D, Affine2DBase, Bbox, \
+ BboxTransformTo, IdentityTransform, Transform, TransformWrapper
+from matplotlib.projections import register_projection
+
+import numpy as np
+
+# This example projection class is rather long, but it is designed to
+# illustrate many features, not all of which will be used every time.
+# It is also common to factor out a lot of these methods into common
+# code used by a number of projections with similar characteristics
+# (see geo.py).
+
+class HammerAxes(Axes):
+ """
+ A custom class for the Aitoff-Hammer projection, an equal-area map
+ projection.
+
+ http://en.wikipedia.org/wiki/Hammer_projection
+ """
+ # The projection must specify a name. This will be used be the
+ # user to select the projection, i.e. ``subplot(111,
+ # projection='hammer')``.
+ name = 'hammer'
+
+ # The number of interpolation steps when converting from straight
+ # lines to curves. (See ``transform_path``).
+ RESOLUTION = 75
+
+ def __init__(self, *args, **kwargs):
+ Axes.__init__(self, *args, **kwargs)
+ self.set_aspect(0.5, adjustable='box', anchor='C')
+ self.cla()
+
+ def cla(self):
+ """
+ Override to set up some reasonable defaults.
+ """
+ # Don't forget to call the base class
+ Axes.cla(self)
+
+ # Set up a default grid spacing
+ self.set_longitude_grid(30)
+ self.set_latitude_grid(15)
+ self.set_longitude_grid_ends(75)
+
+ # Turn off minor ticking altogether
+ self.xaxis.set_minor_locator(NullLocator())
+ self.yaxis.set_minor_locator(NullLocator())
+
+ # Do not display ticks -- we only want gridlines and text
+ self.xaxis.set_ticks_position('none')
+ self.yaxis.set_ticks_position('none')
+
+ # The limits on this projection are fixed -- they are not to
+ # be changed by the user. This makes the math in the
+ # transformation itself easier, and since this is a toy
+ # example, the easier, the better.
+ Axes.set_xlim(self, -np.pi, np.pi)
+ Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
+
+ def cla(self):
+ """
+ Initialize the Axes object to reasonable defaults.
+ """
+ Axes.cla(self)
+
+ self.set_longitude_grid(30)
+ self.set_latitude_grid(15)
+ self.set_longitude_grid_ends(75)
+ self.xaxis.set_minor_locator(NullLocator())
+ self.yaxis.set_minor_locator(NullLocator())
+ self.xaxis.set_ticks_position('none')
+ self.yaxis.set_ticks_position('none')
+
+ # self.grid(rcParams['axes.grid'])
+
+ Axes.set_xlim(self, -np.pi, np.pi)
+ Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
+
+ def _set_lim_and_transforms(self):
+ """
+ This is called once when the plot is created to set up all the
+ transforms for the data, text and grids.
+ """
+ # There are three important coordinate spaces going on here:
+ #
+ # 1. Data space: The space of the data itself
+ #
+ # 2. Axes space: The unit rectangle (0, 0) to (1, 1)
+ # covering the entire plot area.
+ #
+ # 3. Display space: The coordinates of the resulting image,
+ # often in pixels or dpi/inch.
+
+ # This function makes heavy use of the Transform classes in
+ # ``lib/matplotlib/transforms.py.`` For more information, see
+ # the inline documentation there.
+
+ # The goal of the first two transformations is to get from the
+ # data space (in this case longitude and latitude) to axes
+ # space. It is separated into a non-affine and affine part so
+ # that the non-affine part does not have to be recomputed when
+ # a simple affine change to the figure has been made (such as
+ # resizing the window or changing the dpi).
+
+ # 1) The core transformation from data space into
+ # rectilinear space defined in the HammerTransform class.
+ self.transProjection = self.HammerTransform(self.RESOLUTION)
+
+ # 2) The above has an output range that is not in the unit
+ # rectangle, so scale and translate it so it fits correctly
+ # within the axes. The peculiar calculations of xscale and
+ # yscale are specific to a Aitoff-Hammer projection, so don't
+ # worry about them too much.
+ xscale = 2.0 * np.sqrt(2.0) * np.sin(0.5 * np.pi)
+ yscale = np.sqrt(2.0) * np.sin(0.5 * np.pi)
+ self.transAffine = Affine2D() \
+ .scale(0.5 / xscale, 0.5 / yscale) \
+ .translate(0.5, 0.5)
+
+ # 3) This is the transformation from axes space to display
+ # space.
+ self.transAxes = BboxTransformTo(self.bbox)
+
+ # Now put these 3 transforms together -- from data all the way
+ # to display coordinates. Using the '+' operator, these
+ # transforms will be applied "in order". The transforms are
+ # automatically simplified, if possible, by the underlying
+ # transformation framework.
+ self.transData = \
+ self.transProjection + \
+ self.transAffine + \
+ self.transAxes
+
+ # The main data transformation is set up. Now deal with
+ # gridlines and tick labels.
+
+ # Longitude gridlines and ticklabels. The input to these
+ # transforms are in display space in x and axes space in y.
+ # Therefore, the input values will be in range (-xmin, 0),
+ # (xmax, 1). The goal of these transforms is to go from that
+ # space to display space. The tick labels will be offset 4
+ # pixels from the equator.
+ self._xaxis_pretransform = \
+ Affine2D() \
+ .scale(1.0, np.pi) \
+ .translate(0.0, -np.pi)
+ self._xaxis_transform = \
+ self._xaxis_pretransform + \
+ self.transData
+ self._xaxis_text1_transform = \
+ Affine2D().scale(1.0, 0.0) + \
+ self.transData + \
+ Affine2D().translate(0.0, 4.0)
+ self._xaxis_text2_transform = \
+ Affine2D().scale(1.0, 0.0) + \
+ self.transData + \
+ Affine2D().translate(0.0, -4.0)
+
+ # Now set up the transforms for the latitude ticks. The input to
+ # these transforms are in axes space in x and display space in
+ # y. Therefore, the input values will be in range (0, -ymin),
+ # (1, ymax). The goal of these transforms is to go from that
+ # space to display space. The tick labels will be offset 4
+ # pixels from the edge of the axes ellipse.
+ yaxis_stretch = Affine2D().scale(np.pi * 2.0, 1.0).translate(-np.pi, 0.0)
+ yaxis_space = Affine2D().scale(1.0, 1.1)
+ self._yaxis_transform = \
+ yaxis_stretch + \
+ self.transData
+ yaxis_text_base = \
+ yaxis_stretch + \
+ self.transProjection + \
+ (yaxis_space + \
+ self.transAffine + \
+ self.transAxes)
+ self._yaxis_text1_transform = \
+ yaxis_text_base + \
+ Affine2D().translate(-8.0, 0.0)
+ self._yaxis_text2_transform = \
+ yaxis_text_base + \
+ Affine2D().translate(8.0, 0.0)
+
+ def get_xaxis_transform(self):
+ """
+ Override this method to provide a transformation for the
+ x-axis grid and ticks.
+ """
+ return self._xaxis_transform
+
+ def get_xaxis_text1_transform(self, pixelPad):
+ """
+ Override this method to provide a transformation for the
+ x-axis tick labels.
+
+ Returns a tuple of the form (transform, valign, halign)
+ """
+ return self._xaxis_text1_transform, 'bottom', 'center'
+
+ def get_xaxis_text2_transform(self, pixelPad):
+ """
+ Override this method to provide a transformation for the
+ secondary x-axis tick labels.
+
+ Returns a tuple of the form (transform, valign, halign)
+ """
+ return self._xaxis_text2_transform, 'top', 'center'
+
+ def get_yaxis_transform(self):
+ """
+ Override this method to provide a transformation for the
+ y-axis grid and ticks.
+ """
+ return self._yaxis_transform
+
+ def get_yaxis_text1_transform(self, pixelPad):
+ """
+ Override this method to provide a transformation for the
+ y-axis tick labels.
+
+ Returns a tuple of the form (transform, valign, halign)
+ """
+ return self._yaxis_text1_transform, 'center', 'right'
+
+ def get_yaxis_text2_transform(self, pixelPad):
+ """
+ Override this method to provide a transformation for the
+ secondary y-axis tick labels.
+
+ Returns a tuple of the form (transform, valign, halign)
+ """
+ return self._yaxis_text2_transform, 'center', 'left'
+
+ def get_axes_patch(self):
+ """
+ Override this method to define the shape that is used for the
+ background of the plot. It should be a subclass of Patch.
+
+ In this case, it is a Circle (that may be warped by the axes
+ transform into an ellipse). Any data and gridlines will be
+ clipped to this shape.
+ """
+ return Circle((0.5, 0.5), 0.5)
+
+ # Prevent the user from applying scales to one or both of the
+ # axes. In this particular case, scaling the axes wouldn't make
+ # sense, so we don't allow it.
+ def set_xscale(self, *args, **kwargs):
+ if args[0] != 'linear':
+ raise NotImplementedError
+ Axes.set_xscale(self, *args, **kwargs)
+
+ def set_yscale(self, *args, **kwargs):
+ if args[0] != 'linear':
+ raise NotImplementedError
+ Axes.set_yscale(self, *args, **kwargs)
+
+ # Prevent the user from changing the axes limits. In our case, we
+ # want to display the whole sphere all the time, so we override
+ # set_xlim and set_ylim to ignore any input. This also applies to
+ # interactive panning and zooming in the GUI interfaces.
+ def set_xlim(self, *args, **kwargs):
+ Axes.set_xlim(self, -np.pi, np.pi)
+ Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
+ set_ylim = set_xlim
+
+ def format_coord(self, long, lat):
+ """
+ Override this method to change how the values are displayed in
+ the status bar.
+
+ In this case, we want them to be displayed in degrees N/S/E/W.
+ """
+ long = long * (180.0 / np.pi)
+ lat = lat * (180.0 / np.pi)
+ if lat >= 0.0:
+ ns = 'N'
+ else:
+ ns = 'S'
+ if long >= 0.0:
+ ew = 'E'
+ else:
+ ew = 'W'
+ # \u00b0 : degree symbol
+ return u'%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(long), ew)
+
+ class DegreeFormatter(Formatter):
+ """
+ This is a custom formatter that converts the native unit of
+ radians into (truncated) degrees and adds a degree symbol.
+ """
+ def __init__(self, round_to=1.0):
+ self._round_to = round_to
+
+ def __call__(self, x, pos=None):
+ degrees = (x / np.pi) * 180.0
+ degrees = round(degrees / self._round_to) * self._round_to
+ # \u00b0 : degree symbol
+ return u"%d\u00b0" % degrees
+
+ def set_longitude_grid(self, degrees):
+ """
+ Set the number of degrees between each longitude grid.
+
+ This is an example method that is specific to this projection
+ class -- it provides a more convenient interface to set the
+ ticking than set_xticks would.
+ """
+ # Set up a FixedLocator at each of the points, evenly spaced
+ # by degrees.
+ number = (360.0 / degrees) + 1
+ self.xaxis.set_major_locator(
+ FixedLocator(
+ np.linspace(-np.pi, np.pi, number, True)[1:-1]))
+ # Set the formatter to display the tick labels in degrees,
+ # rather than radians.
+ self.xaxis.set_major_formatter(self.DegreeFormatter(degrees))
+
+ def set_latitude_grid(self, degrees):
+ """
+ Set the number of degrees between each longitude grid.
+
+ This is an example method that is specific to this projection
+ class -- it provides a more convenient interface than
+ set_yticks would.
+ """
+ # Set up a FixedLocator at each of the points, evenly spaced
+ # by degrees.
+ number = (180.0 / degrees) + 1
+ self.yaxis.set_major_locator(
+ FixedLocator(
+ np.linspace(-np.pi / 2.0, np.pi / 2.0, number, True)[1:-1]))
+ # Set the formatter to display the tick labels in degrees,
+ # rather than radians.
+ self.yaxis.set_major_formatter(self.DegreeFormatter(degrees))
+
+ def set_longitude_grid_ends(self, degrees):
+ """
+ Set the latitude(s) at which to stop drawing the longitude grids.
+
+ Often, in geographic projections, you wouldn't want to draw
+ longitude gridlines near the poles. This allows the user to
+ specify the degree at which to stop drawing longitude grids.
+
+ This is an example method that is specific to this projection
+ class -- it provides an interface to something that has no
+ analogy in the base Axes class.
+ """
+ longitude_cap = degrees * (np.pi / 180.0)
+ # Change the xaxis gridlines transform so that it draws from
+ # -degrees to degrees, rather than -pi to pi.
+ self._xaxis_pretransform \
+ .clear() \
+ .scale(1.0, longitude_cap * 2.0) \
+ .translate(0.0, -longitude_cap)
+
+ def get_data_ratio(self):
+ """
+ Return the aspect ratio of the data itself.
+
+ This method should be overridden by any Axes that have a
+ fixed data ratio.
+ """
+ return 1.0
+
+ # Interactive panning and zooming is not supported with this projection,
+ # so we override all of the following methods to disable it.
+ def can_zoom(self):
+ """
+ Return True if this axes support the zoom box
+ """
+ return False
+ def start_pan(self, x, y, button):
+ pass
+ def end_pan(self):
+ pass
+ def drag_pan(self, button, key, x, y):
+ pass
+
+ # Now, the transforms themselves.
+
+ class HammerTransform(Transform):
+ """
+ The base Hammer transform.
+ """
+ input_dims = 2
+ output_dims = 2
+ is_separable = False
+
+ def __init__(self, resolution):
+ """
+ Create a new Hammer transform. Resolution is the number of steps
+ to interpolate between each input line segment to approximate its
+ path in curved Hammer space.
+ """
+ Transform.__init__(self)
+ self._resolution = resolution
+
+ def transform(self, ll):
+ """
+ Override the transform method to implement the custom transform.
+
+ The input and output are Nx2 numpy arrays.
+ """
+ longitude = ll[:, 0:1]
+ latitude = ll[:, 1:2]
+
+ # Pre-compute some values
+ half_long = longitude / 2.0
+ cos_latitude = np.cos(latitude)
+ sqrt2 = np.sqrt(2.0)
+
+ alpha = 1.0 + cos_latitude * np.cos(half_long)
+ x = (2.0 * sqrt2) * (cos_latitude * np.sin(half_long)) / alpha
+ y = (sqrt2 * np.sin(latitude)) / alpha
+ return np.concatenate((x, y), 1)
+
+ # This is where things get interesting. With this projection,
+ # straight lines in data space become curves in display space.
+ # This is done by interpolating new values between the input
+ # values of the data. Since ``transform`` must not return a
+ # differently-sized array, any transform that requires
+ # changing the length of the data array must happen within
+ # ``transform_path``.
+ def transform_path(self, path):
+ vertices = path.vertices
+ ipath = path.interpolated(self._resolution)
+ return Path(self.transform(ipath.vertices), ipath.codes)
+
+ def inverted(self):
+ return HammerAxes.InvertedHammerTransform(self._resolution)
+ inverted.__doc__ = Transform.inverted.__doc__
+
+ class InvertedHammerTransform(Transform):
+ input_dims = 2
+ output_dims = 2
+ is_separable = False
+
+ def __init__(self, resolution):
+ Transform.__init__(self)
+ self._resolution = resolution
+
+ def transform(self, xy):
+ x = xy[:, 0:1]
+ y = xy[:, 1:2]
+
+ quarter_x = 0.25 * x
+ half_y = 0.5 * y
+ z = np.sqrt(1.0 - quarter_x*quarter_x - half_y*half_y)
+ longitude = 2 * np.arctan((z*x) / (2.0 * (2.0*z*z - 1.0)))
+ latitude = np.arcsin(y*z)
+ return np.concatenate((longitude, latitude), 1)
+ transform.__doc__ = Transform.transform.__doc__
+
+ def inverted(self):
+ # The inverse of the inverse is the original transform... ;)
+ return HammerAxes.HammerTransform(self._resolution)
+ inverted.__doc__ = Transform.inverted.__doc__
+
+# Now register the projection with matplotlib so the user can select
+# it.
+register_projection(HammerAxes)
+
+# Now make a simple example using the custom projection.
+from pylab import *
+
+subplot(111, projection="hammer")
+grid(True)
+
+show()
Copied: trunk/matplotlib/examples/api/custom_scale_example.py (from rev 5226, trunk/matplotlib/examples/pylab/custom_scale_example.py)
===================================================================
--- trunk/matplotlib/examples/api/custom_scale_example.py (rev 0)
+++ trunk/matplotlib/examples/api/custom_scale_example.py 2008-05-23 17:41:36 UTC (rev 5230)
@@ -0,0 +1,165 @@
+from matplotlib import scale as mscale
+from matplotlib import transforms as mtransforms
+
+class MercatorLatitudeScale(mscale.ScaleBase):
+ """
+ Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using
+ the system used to scale latitudes in a Mercator projection.
+
+ The scale function:
+ ln(tan(y) + sec(y))
+
+ The inverse scale function:
+ atan(sinh(y))
+
+ Since the Mercator scale tends to infinity at +/- 90 degrees,
+ there is user-defined threshold, above and below which nothing
+ will be plotted. This defaults to +/- 85 degrees.
+
+ source:
+ http://en.wikipedia.org/wiki/Mercator_projection
+ """
+
+ # The scale class must have a member ``name`` that defines the
+ # string used to select the scale. For example,
+ # ``gca().set_yscale("mercator")`` would be used to select this
+ # scale.
+ name = 'mercator'
+
+
+ def __init__(self, axis, **kwargs):
+ """
+ Any keyword arguments passed to ``set_xscale`` and
+ ``set_yscale`` will be passed along to the scale's
+ constructor.
+
+ thresh: The degree above which to crop the data.
+ """
+ mscale.ScaleBase.__init__(self)
+ thresh = kwargs.pop("thresh", (85 / 180.0) * np.pi)
+ if thresh >= np.pi / 2.0:
+ raise ValueError("thresh must be less than pi/2")
+ self.thresh = thresh
+
+ def get_transform(self):
+ """
+ Override this method to return a new instance that does the
+ actual transformation of the data.
+
+ The MercatorLatitudeTransform class is defined below as a
+ nested class of this one.
+ """
+ return self.MercatorLatitudeTransform(self.thresh)
+
+ def set_default_locators_and_formatters(self, axis):
+ """
+ Override to set up the locators and formatters to use with the
+ scale. This is only required if the scale requires custom
+ locators and formatters. Writing custom locators and
+ formatters is rather outside the scope of this example, but
+ there are many helpful examples in ``ticker.py``.
+
+ In our case, the Mercator example uses a fixed locator from
+ -90 to 90 degrees and a custom formatter class to put convert
+ the radians to degrees and put a degree symbol after the
+ value::
+ """
+ class DegreeFormatter(Formatter):
+ def __call__(self, x, pos=None):
+ # \u00b0 : degree symbol
+ return u"%d\u00b0" % ((x / np.pi) * 180.0)
+
+ deg2rad = np.pi / 180.0
+ axis.set_major_locator(FixedLocator(
+ np.arange(-90, 90, 10) * deg2rad))
+ axis.set_major_formatter(DegreeFormatter())
+ axis.set_minor_formatter(DegreeFormatter())
+
+ def limit_range_for_scale(self, vmin, vmax, minpos):
+ """
+ Override to limit the bounds of the axis to the domain of the
+ transform. In the case of Mercator, the bounds should be
+ limited to the threshold that was passed in. Unlike the
+ autoscaling provided by the tick locators, this range limiting
+ will always be adhered to, whether the axis range is set
+ manually, determined automatically or changed through panning
+ and zooming.
+ """
+ return max(vmin, -self.thresh), min(vmax, self.thresh)
+
+ class MercatorLatitudeTransform(mtransforms.Transform):
+ # There are two value members that must be defined.
+ # ``input_dims`` and ``output_dims`` specify number of input
+ # dimensions and output dimensions to the transformation.
+ # These are used by the transformation framework to do some
+ # error checking and prevent incompatible transformations from
+ # being connected together. When defining transforms for a
+ # scale, which are, by definition, separable and have only one
+ # dimension, these members should always be set to 1.
+ input_dims = 1
+ output_dims = 1
+ is_separable = True
+
+ def __init__(self, thresh):
+ mtransforms.Transform.__init__(self)
+ self.thresh = thresh
+
+ def transform(self, a):
+ """
+ This transform takes an Nx1 ``numpy`` array and returns a
+ transformed copy. Since the range of the Mercator scale
+ is limited by the user-specified threshold, the input
+ array must be masked to contain only valid values.
+ ``matplotlib`` will handle masked arrays and remove the
+ out-of-range data from the plot. Importantly, the
+ ``transform`` method *must* return an array that is the
+ same shape as the input array, since these values need to
+ remain synchronized with values in the other dimension.
+ """
+ masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a)
+ if masked.mask.any():
+ return ma.log(np.abs(ma.tan(masked) + 1.0 / ma.cos(masked)))
+ else:
+ return np.log(np.abs(np.tan(a) + 1.0 / np.cos(a)))
+
+ def inverted(self):
+ """
+ Override this method so matplotlib knows how to get the
+ inverse transform for this transform.
+ """
+ return MercatorLatitudeScale.InvertedMercatorLatitudeTransform(self.thresh)
+
+ class InvertedMercatorLatitudeTransform(mtransforms.Transform):
+ input_dims = 1
+ output_dims = 1
+ is_separable = True
+
+ def __init__(self, thresh):
+ mtransforms.Transform.__init__(self)
+ self.thresh = thresh
+
+ def transform(self, a):
+ return np.arctan(np.sinh(a))
+
+ def inverted(self):
+ return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh)
+
+# Now that the Scale class has been defined, it must be registered so
+# that ``matplotlib`` can find it.
+mscale.register_scale(MercatorLatitudeScale)
+
+from pylab import *
+import numpy as np
+
+t = arange(-180.0, 180.0, 0.1)
+s = t / 360.0 * np.pi
+
+plot(t, s, '-', lw=2)
+gca().set_yscale('mercator')
+
+xlabel('Longitude')
+ylabel('Latitude')
+title('Mercator: Projection of the Oppressor')
+grid(True)
+
+show()
Deleted: trunk/matplotlib/examples/pylab/custom_projection_example.py
===================================================================
--- trunk/matplotlib/examples/pylab/custom_projection_example.py 2008-05-23 17:41:07 UTC (rev 5229)
+++ trunk/matplotlib/examples/pylab/custom_projection_example.py 2008-05-23 17:41:36 UTC (rev 5230)
@@ -1,475 +0,0 @@
-from matplotlib.axes import Axes
-from matplotlib import cbook
-from matplotlib.patches import Circle
-from matplotlib.path import Path
-from matplotlib.ticker import Formatter, Locator, NullLocator, FixedLocator, NullFormatter
-from matplotlib.transforms import Affine2D, Affine2DBase, Bbox, \
- BboxTransformTo, IdentityTransform, Transform, TransformWrapper
-from matplotlib.projections import register_projection
-
-import numpy as np
-
-# This example projection class is rather long, but it is designed to
-# illustrate many features, not all of which will be used every time.
-# It is also common to factor out a lot of these methods into common
-# code used by a number of projections with similar characteristics
-# (see geo.py).
-
-class HammerAxes(Axes):
- """
- A custom class for the Aitoff-Hammer projection, an equal-area map
- projection.
-
- http://en.wikipedia.org/wiki/Hammer_projection
- """
- # The projection must specify a name. This will be used be the
- # user to select the projection, i.e. ``subplot(111,
- # projection='hammer')``.
- name = 'hammer'
-
- # The number of interpolation steps when converting from straight
- # lines to curves. (See ``transform_path``).
- RESOLUTION = 75
-
- def __init__(self, *args, **kwargs):
- Axes.__init__(self, *args, **kwargs)
- self.set_aspect(0.5, adjustable='box', anchor='C')
- self.cla()
-
- def cla(self):
- """
- Override to set up some reasonable defaults.
- """
- # Don't forget to call the base class
- Axes.cla(self)
-
- # Set up a default grid spacing
- self.set_longitude_grid(30)
- self.set_latitude_grid(15)
- self.set_longitude_grid_ends(75)
-
- # Turn off minor ticking altogether
- self.xaxis.set_minor_locator(NullLocator())
- self.yaxis.set_minor_locator(NullLocator())
-
- # Do not display ticks -- we only want gridlines and text
- self.xaxis.set_ticks_position('none')
- self.yaxis.set_ticks_position('none')
-
- # The limits on this projection are fixed -- they are not to
- # be changed by the user. This makes the math in the
- # transformation itself easier, and since this is a toy
- # example, the easier, the better.
- Axes.set_xlim(self, -np.pi, np.pi)
- Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
-
- def cla(self):
- """
- Initialize the Axes object to reasonable defaults.
- """
- Axes.cla(self)
-
- self.set_longitude_grid(30)
- self.set_latitude_grid(15)
- self.set_longitude_grid_ends(75)
- self.xaxis.set_minor_locator(NullLocator())
- self.yaxis.set_minor_locator(NullLocator())
- self.xaxis.set_ticks_position('none')
- self.yaxis.set_ticks_position('none')
-
- # self.grid(rcParams['axes.grid'])
-
- Axes.set_xlim(self, -np.pi, np.pi)
- Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
-
- def _set_lim_and_transforms(self):
- """
- This is called once when the plot is created to set up all the
- transforms for the data, text and grids.
- """
- # There are three important coordinate spaces going on here:
- #
- # 1. Data space: The space of the data itself
- #
- # 2. Axes space: The unit rectangle (0, 0) to (1, 1)
- # covering the entire plot area.
- #
- # 3. Display space: The coordinates of the resulting image,
- # often in pixels or dpi/inch.
-
- # This function makes heavy use of the Transform classes in
- # ``lib/matplotlib/transforms.py.`` For more information, see
- # the inline documentation there.
-
- # The goal of the first two transformations is to get from the
- # data space (in this case longitude and latitude) to axes
- # space. It is separated into a non-affine and affine part so
- # that the non-affine part does not have to be recomputed when
- # a simple affine change to the figure has been made (such as
- # resizing the window or changing the dpi).
-
- # 1) The core transformation from data space into
- # rectilinear space defined in the HammerTransform class.
- self.transProjection = self.HammerTransform(self.RESOLUTION)
-
- # 2) The above has an output range that is not in the unit
- # rectangle, so scale and translate it so it fits correctly
- # within the axes. The peculiar calculations of xscale and
- # yscale are specific to a Aitoff-Hammer projection, so don't
- # worry about them too much.
- xscale = 2.0 * np.sqrt(2.0) * np.sin(0.5 * np.pi)
- yscale = np.sqrt(2.0) * np.sin(0.5 * np.pi)
- self.transAffine = Affine2D() \
- .scale(0.5 / xscale, 0.5 / yscale) \
- .translate(0.5, 0.5)
-
- # 3) This is the transformation from axes space to display
- # space.
- self.transAxes = BboxTransformTo(self.bbox)
-
- # Now put these 3 transforms together -- from data all the way
- # to display coordinates. Using the '+' operator, these
- # transforms will be applied "in order". The transforms are
- # automatically simplified, if possible, by the underlying
- # transformation framework.
- self.transData = \
- self.transProjection + \
- self.transAffine + \
- self.transAxes
-
- # The main data transformation is set up. Now deal with
- # gridlines and tick labels.
-
- # Longitude gridlines and ticklabels. The input to these
- # transforms are in display space in x and axes space in y.
- # Therefore, the input values will be in range (-xmin, 0),
- # (xmax, 1). The goal of these transforms is to go from that
- # space to display space. The tick labels will be offset 4
- # pixels from the equator.
- self._xaxis_pretransform = \
- Affine2D() \
- .scale(1.0, np.pi) \
- .translate(0.0, -np.pi)
- self._xaxis_transform = \
- self._xaxis_pretransform + \
- self.transData
- self._xaxis_text1_transform = \
- Affine2D().scale(1.0, 0.0) + \
- self.transData + \
- Affine2D().translate(0.0, 4.0)
- self._xaxis_text2_transform = \
- Affine2D().scale(1.0, 0.0) + \
- self.transData + \
- Affine2D().translate(0.0, -4.0)
-
- # Now set up the transforms for the latitude ticks. The input to
- # these transforms are in axes space in x and display space in
- # y. Therefore, the input values will be in range (0, -ymin),
- # (1, ymax). The goal of these transforms is to go from that
- # space to display space. The tick labels will be offset 4
- # pixels from the edge of the axes ellipse.
- yaxis_stretch = Affine2D().scale(np.pi * 2.0, 1.0).translate(-np.pi, 0.0)
- yaxis_space = Affine2D().scale(1.0, 1.1)
- self._yaxis_transform = \
- yaxis_stretch + \
- self.transData
- yaxis_text_base = \
- yaxis_stretch + \
- self.transProjection + \
- (yaxis_space + \
- self.transAffine + \
- self.transAxes)
- self._yaxis_text1_transform = \
- yaxis_text_base + \
- Affine2D().translate(-8.0, 0.0)
- self._yaxis_text2_transform = \
- yaxis_text_base + \
- Affine2D().translate(8.0, 0.0)
-
- def get_xaxis_transform(self):
- """
- Override this method to provide a transformation for the
- x-axis grid and ticks.
- """
- return self._xaxis_transform
-
- def get_xaxis_text1_transform(self, pixelPad):
- """
- Override this method to provide a transformation for the
- x-axis tick labels.
-
- Returns a tuple of the form (transform, valign, halign)
- """
- return self._xaxis_text1_transform, 'bottom', 'center'
-
- def get_xaxis_text2_transform(self, pixelPad):
- """
- Override this method to provide a transformation for the
- secondary x-axis tick labels.
-
- Returns a tuple of the form (transform, valign, halign)
- """
- return self._xaxis_text2_transform, 'top', 'center'
-
- def get_yaxis_transform(self):
- """
- Override this method to provide a transformation for the
- y-axis grid and ticks.
- """
- return self._yaxis_transform
-
- def get_yaxis_text1_transform(self, pixelPad):
- """
- Override this method to provide a transformation for the
- y-axis tick labels.
-
- Returns a tuple of the form (transform, valign, halign)
- """
- return self._yaxis_text1_transform, 'center', 'right'
-
- def get_yaxis_text2_transform(self, pixelPad):
- """
- Override this method to provide a transformation for the
- secondary y-axis tick labels.
-
- Returns a tuple of the form (transform, valign, halign)
- """
- return self._yaxis_text2_transform, 'center', 'left'
-
- def get_axes_patch(self):
- """
- Override this method to define the shape that is used for the
- background of the plot. It should be a subclass of Patch.
-
- In this case, it is a Circle (that may be warped by the axes
- transform into an ellipse). Any data and gridlines will be
- clipped to this shape.
- """
- return Circle((0.5, 0.5), 0.5)
-
- # Prevent the user from applying scales to one or both of the
- # axes. In this particular case, scaling the axes wouldn't make
- # sense, so we don't allow it.
- def set_xscale(self, *args, **kwargs):
- if args[0] != 'linear':
- raise NotImplementedError
- Axes.set_xscale(self, *args, **kwargs)
-
- def set_yscale(self, *args, **kwargs):
- if args[0] != 'linear':
- raise NotImplementedError
- Axes.set_yscale(self, *args, **kwargs)
-
- # Prevent the user from changing the axes limits. In our case, we
- # want to display the whole sphere all the time, so we override
- # set_xlim and set_ylim to ignore any input. This also applies to
- # interactive panning and zooming in the GUI interfaces.
- def set_xlim(self, *args, **kwargs):
- Axes.set_xlim(self, -np.pi, np.pi)
- Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
- set_ylim = set_xlim
-
- def format_coord(self, long, lat):
- """
- Override this method to change how the values are displayed in
- the status bar.
-
- In this case, we want them to be displayed in degrees N/S/E/W.
- """
- long = long * (180.0 / np.pi)
- lat = lat * (180.0 / np.pi)
- if lat >= 0.0:
- ns = 'N'
- else:
- ns = 'S'
- if long >= 0.0:
- ew = 'E'
- else:
- ew = 'W'
- # \u00b0 : degree symbol
- return u'%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(long), ew)
-
- class DegreeFormatter(Formatter):
- """
- This is a custom formatter that converts the native unit of
- radians into (truncated) degrees and adds a degree symbol.
- """
- def __init__(self, round_to=1.0):
- self._round_to = round_to
-
- def __call__(self, x, pos=None):
- degrees = (x / np.pi) * 180.0
- degrees = round(degrees / self._round_to) * self._round_to
- # \u00b0 : degree symbol
- return u"%d\u00b0" % degrees
-
- def set_longitude_grid(self, degrees):
- """
- Set the number of degrees between each longitude grid.
-
- This is an example method that is specific to this projection
- class -- it provides a more convenient interface to set the
- ticking than set_xticks would.
- """
- # Set up a FixedLocator at each of the points, evenly spaced
- # by degrees.
- number = (360.0 / degrees) + 1
- self.xaxis.set_major_locator(
- FixedLocator(
- np.linspace(-np.pi, np.pi, number, True)[1:-1]))
- # Set the formatter to display the tick labels in degrees,
- # rather than radians.
- self.xaxis.set_major_formatter(self.DegreeFormatter(degrees))
-
- def set_latitude_grid(self, degrees):
- """
- Set the number of degrees between each longitude grid.
-
- This is an example method that is specific to this projection
- class -- it provides a more convenient interface than
- set_yticks would.
- """
- # Set up a FixedLocator at each of the points, evenly spaced
- # by degrees.
- number = (180.0 / degrees) + 1
- self.yaxis.set_major_locator(
- FixedLocator(
- np.linspace(-np.pi / 2.0, np.pi / 2.0, number, True)[1:-1]))
- # Set the formatter to display the tick labels in degrees,
- # rather than radians.
- self.yaxis.set_major_formatter(self.DegreeFormatter(degrees))
-
- def set_longitude_grid_ends(self, degrees):
- """
- Set the latitude(s) at which to stop drawing the longitude grids.
-
- Often, in geographic projections, you wouldn't want to draw
- longitude gridlines near the poles. This allows the user to
- specify the degree at which to stop drawing longitude grids.
-
- This is an example method that is specific to this projection
- class -- it provides an interface to something that has no
- analogy in the base Axes class.
- """
- longitude_cap = degrees * (np.pi / 180.0)
- # Change the xaxis gridlines transform so that it draws from
- # -degrees to degrees, rather than -pi to pi.
- self._xaxis_pretransform \
- .clear() \
- .scale(1.0, longitude_cap * 2.0) \
- .translate(0.0, -longitude_cap)
-
- def get_data_ratio(self):
- """
- Return the aspect ratio of the data itself.
-
- This method should be overridden by any Axes that have a
- fixed data ratio.
- """
- return 1.0
-
- # Interactive panning and zooming is not supported with this projection,
- # so we override all of the following methods to disable it.
- def can_zoom(self):
- """
- Return True if this axes support the zoom box
- """
- return False
- def start_pan(self, x, y, button):
- pass
- def end_pan(self):
- pass
- def drag_pan(self, button, key, x, y):
- pass
-
- # Now, the transforms themselves.
-
- class HammerTransform(Transform):
- """
- The base Hammer transform.
- """
- input_dims = 2
- output_dims = 2
- is_separable = False
-
- def __init__(self, resolution):
- """
- Create a new Hammer transform. Resolution is the number of steps
- to interpolate between each input line segment to approximate its
- path in curved Hammer space.
- """
- Transform.__init__(self)
- self._resolution = resolution
-
- def transform(self, ll):
- """
- Override the transform method to implement the custom transform.
-
- The input and output are Nx2 numpy arrays.
- """
- longitude = ll[:, 0:1]
- latitude = ll[:, 1:2]
-
- # Pre-compute some values
- half_long = longitude / 2.0
- cos_latitude = np.cos(latitude)
- sqrt2 = np.sqrt(2.0)
-
- alpha = 1.0 + cos_latitude * np.cos(half_long)
- x = (2.0 * sqrt2) * (cos_latitude * np.sin(half_long)) / alpha
- y = (sqrt2 * np.sin(latitude)) / alpha
- return np.concatenate((x, y), 1)
-
- # This is where things get interesting. With this projection,
- # straight lines in data space become curves in display space.
- # This is done by interpolating new values between the input
- # values of the data. Since ``transform`` must not return a
- # differently-sized array, any transform that requires
- # changing the length of the data array must happen within
- # ``transform_path``.
- def transform_path(self, path):
- vertices = path.vertices
- ipath = path.interpolated(self._resolution)
- return Path(self.transform(ipath.vertices), ipath.codes)
-
- def inverted(self):
- return HammerAxes.InvertedHammerTransform(self._resolution)
- inverted.__doc__ = Transform.inverted.__doc__
-
- class InvertedHammerTransform(Transform):
- input_dims = 2
- output_dims = 2
- is_separable = False
-
- def __init__(self, resolution):
- Transform.__init__(self)
- self._resolution = resolution
-
- def transform(self, xy):
- x = xy[:, 0:1]
- y = xy[:, 1:2]
-
- quarter_x = 0.25 * x
- half_y = 0.5 * y
- z = np.sqrt(1.0 - quarter_x*quarter_x - half_y*half_y)
- longitude = 2 * np.arctan((z*x) / (2.0 * (2.0*z*z - 1.0)))
- latitude = np.arcsin(y*z)
- return np.concatenate((longitude, latitude), 1)
- transform.__doc__ = Transform.transform.__doc__
-
- def inverted(self):
- # The inverse of the inverse is the original transform... ;)
- return HammerAxes.HammerTransform(self._resolution)
- inverted.__doc__ = Transform.inverted.__doc__
-
-# Now register the projection with matplotlib so the user can select
-# it.
-register_projection(HammerAxes)
-
-# Now make a simple example using the custom projection.
-from pylab import *
-
-subplot(111, projection="hammer")
-grid(True)
-
-show()
Deleted: trunk/matplotlib/examples/pylab/custom_scale_example.py
===================================================================
--- trunk/matplotlib/examples/pylab/custom_scale_example.py 2008-05-23 17:41:07 UTC (rev 5229)
+++ trunk/matplotlib/examples/pylab/custom_scale_example.py 2008-05-23 17:41:36 UTC (rev 5230)
@@ -1,165 +0,0 @@
-from matplotlib import scale as mscale
-from matplotlib import transforms as mtransforms
-
-class MercatorLatitudeScale(mscale.ScaleBase):
- """
- Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using
- the system used to scale latitudes in a Mercator projection.
-
- The scale function:
- ln(tan(y) + sec(y))
-
- The inverse scale function:
- atan(sinh(y))
-
- Since the Mercator scale tends to infinity at +/- 90 degrees,
- there is user-defined threshold, above and below which nothing
- will be plotted. This defaults to +/- 85 degrees.
-
- source:
- http://en.wikipedia.org/wiki/Mercator_projection
- """
-
- # The scale class must have a member ``name`` that defines the
- # string used to select the scale. For example,
- # ``gca().set_yscale("mercator")`` would be used to select this
- # scale.
- name = 'mercator'
-
-
- def __init__(self, axis, **kwargs):
- """
- Any keyword arguments passed to ``set_xscale`` and
- ``set_yscale`` will be passed along to the scale's
- constructor.
-
- thresh: The degree above which to crop the data.
- """
- mscale.ScaleBase.__init__(self)
- thresh = kwargs.pop("thresh", (85 / 180.0) * np.pi)
- if thresh >= np.pi / 2.0:
- raise ValueError("thresh must be less than pi/2")
- self.thresh = thresh
-
- def get_transform(self):
- """
- Override this method to return a new instance that does the
- actual transformation of the data.
-
- The MercatorLatitudeTransform class is defined below as a
- nested class of this one.
- """
- return self.MercatorLatitudeTransform(self.thresh)
-
- def set_default_locators_and_formatters(self, axis):
- """
- Override to set up the locators and formatters to use with the
- scale. This is only required if the scale requires custom
- locators and formatters. Writing custom locators and
- formatters is rather outside the scope of this example, but
- there are many helpful examples in ``ticker.py``.
-
- In our case, the Mercator example uses a fixed locator from
- -90 to 90 degrees and a custom formatter class to put convert
- the radians to degrees and put a degree symbol after the
- value::
- """
- class DegreeFormatter(Formatter):
- def __call__(self, x, pos=None):
- # \u00b0 : degree symbol
- return u"%d\u00b0" % ((x / np.pi) * 180.0)
-
- deg2rad = np.pi / 180.0
- axis.set_major_locator(FixedLocator(
- np.arange(-90, 90, 10) * deg2rad))
- axis.set_major_formatter(DegreeFormatter())
- axis.set_minor_formatter(DegreeFormatter())
-
- def limit_range_for_scale(self, vmin, vmax, minpos):
- """
- Override to limit the bounds of the axis to the domain of the
- transform. In the case of Mercator, the bounds should be
- limited to the threshold that was passed in. Unlike the
- autoscaling provided by the tick locators, this range limiting
- will always be adhered to, whether the axis range is set
- manually, determined automatically or changed through panning
- and zooming.
- """
- return max(vmin, -self.thresh), min(vmax, self.thresh)
-
- class MercatorLatitudeTransform(mtransforms.Transform):
- # There are two value members that must be defined.
- # ``input_dims`` and ``output_dims`` specify number of input
- # dimensions and output dimensions to the transformation.
- # These are used by the transformation framework to do some
- # error checking and prevent incompatible transformations from
- # being connected together. When defining transforms for a
- # scale, which are, by definition, separable and have only one
- # dimension, these members should always be set to 1.
- input_dims = 1
- output_dims = 1
- is_separable = True
-
- def __init__(self, thresh):
- mtransforms.Transform.__init__(self)
- self.thresh = thresh
-
- def transform(self, a):
- """
- This transform takes an Nx1 ``numpy`` array and returns a
- transformed copy. Since the range of the Mercator scale
- is limited by the user-specified threshold, the input
- array must be masked to contain only valid values.
- ``matplotlib`` will handle masked arrays and remove the
- out-of-range data from the plot. Importantly, the
- ``transform`` method *must* return an array that is the
- same shape as the input array, since these values need to
- remain synchronized with values in the other dimension.
- """
- masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a)
- if masked.mask.any():
- return ma.log(np.abs(ma.tan(masked) + 1.0 / ma.cos(masked)))
- else:
- return np.log(np.abs(np.tan(a) + 1.0 / np.cos(a)))
-
- def inverted(self):
- """
- Override this method so matplotlib knows how to get the
- inverse transform for this transform.
- """
- return MercatorLatitudeScale.InvertedMercatorLatitudeTransform(self.thresh)
-
- class InvertedMercatorLatitudeTransform(mtransforms.Transform):
- input_dims = 1
- output_dims = 1
- is_separable = True
-
- def __init__(self, thresh):
- mtransforms.Transform.__init__(self)
- self.thresh = thresh
-
- def transform(self, a):
- return np.arctan(np.sinh(a))
-
- def inverted(self):
- return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh)
-
-# Now that the Scale class has been defined, it must be registered so
-# that ``matplotlib`` can find it.
-mscale.register_scale(MercatorLatitudeScale)
-
-from pylab import *
-import numpy as np
-
-t = arange(-180.0, 180.0, 0.1)
-s = t / 360.0 * np.pi
-
-plot(t, s, '-', lw=2)
-gca().set_yscale('mercator')
-
-xlabel('Longitude')
-ylabel('Latitude')
-title('Mercator: Projection of the Oppressor')
-grid(True)
-
-show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-23 17:41:18
|
Revision: 5229
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5229&view=rev
Author: mdboom
Date: 2008-05-23 10:41:07 -0700 (Fri, 23 May 2008)
Log Message:
-----------
Adding cross-references.
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/add_new_projection.txt
Modified: trunk/matplotlib/doc/users_guide/add_new_projection.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/add_new_projection.txt 2008-05-23 16:12:50 UTC (rev 5228)
+++ trunk/matplotlib/doc/users_guide/add_new_projection.txt 2008-05-23 17:41:07 UTC (rev 5229)
@@ -14,9 +14,11 @@
"projections".
From the user's perspective, the scale of a plot can be set with
-``set_xscale()`` and ``set_yscale()``. Projections can be chosen using
-the ``projection`` keyword argument to the ``plot()`` or ``subplot()``
-functions::
+:meth:`~matplotlib.axes.Axes.set_xscale` and
+:meth:`~matplotlib.axes.Axes.set_xscale`. Projections can be chosen
+using the ``projection`` keyword argument to the
+:func:`~matplotlib.pylab.plot` or :func:`~matplotlib.pylab.subplot`
+functions, e.g.::
plot(x, y, projection="custom")
@@ -30,8 +32,8 @@
Creating a new scale
====================
-Adding a new scale consists of defining a subclass of ``ScaleBase``
-(in the ``matplotlib.scale`` module), that includes the following
+Adding a new scale consists of defining a subclass of
+:class:`matplotlib.scale.ScaleBase`, that includes the following
elements:
- A transformation from data coordinates into display coordinates.
@@ -53,20 +55,19 @@
- Formatters (major and minor) that specify how the tick labels
should be drawn.
-Once the class is defined, it must be registered with ``matplotlib``
-so that the user can select it.
+Once the class is defined, it must be registered with matplotlib so
+that the user can select it.
A full-fledged and heavily annotated example is in
-``examples/custom_scale_example.py``. There are also some ``Scale``
-classes in ``scale.py`` that may be used as starting points.
+:file:`examples/api/custom_scale_example.py`. There are also some classes
+in :mod:`matplotlib.scale` that may be used as starting points.
Creating a new projection
=========================
-Adding a new projection consists of defining a subclass of ``Axes``
-(in the ``matplotlib.axes`` module), that includes the following
-elements:
+Adding a new projection consists of defining a subclass of
+:class:`matplotlib.axes.Axes`, that includes the following elements:
- A transformation from data coordinates into display coordinates.
@@ -75,10 +76,11 @@
- Transformations for the gridlines, ticks and ticklabels. Custom
projections will often need to place these elements in special
- locations, and ``matplotlib`` has a facility to help with doing so.
+ locations, and matplotlib has a facility to help with doing so.
- - Setting up default values (overriding ``cla()``), since the
- defaults for a rectilinear axes may not be appropriate.
+ - Setting up default values (overriding
+ :meth:`~matplotlib.axes.Axes.cla`), since the defaults for a
+ rectilinear axes may not be appropriate.
- Defining the shape of the axes, for example, an elliptical axes,
that will be used to draw the background of the plot and for
@@ -90,13 +92,14 @@
- Set up interactive panning and zooming. This is left as an
"advanced" feature left to the reader, but there is an example of
- this for polar plots in ``polar.py``.
+ this for polar plots in :mod:`matplotlib.projections.polar`.
- Any additional methods for additional convenience or features.
-Once the class is defined, it must be registered with ``matplotlib``
+Once the class is defined, it must be registered with matplotlib
so that the user can select it.
A full-fledged and heavily annotated example is in
-``examples/custom_projection_example.py``. The polar plot
-functionality in ``polar.py`` may also be of interest.
+:file:`examples/api/custom_projection_example.py`. The polar plot
+functionality in :mod:`matplotlib.projections.polar` may also be of
+interest.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-23 16:13:16
|
Revision: 5228
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5228&view=rev
Author: dsdale
Date: 2008-05-23 09:12:50 -0700 (Fri, 23 May 2008)
Log Message:
-----------
equation rendering is now working using Jens Mortensen's
mathpng extension. The syntax is illustrated in the
developers guide, in the "Documenting Matplotlib" section
Modified Paths:
--------------
trunk/matplotlib/doc/api_reference/conf.py
trunk/matplotlib/doc/sphinxext/mathpng.py
trunk/matplotlib/doc/users_guide/conf.py
trunk/matplotlib/doc/users_guide/documenting_mpl.txt
Modified: trunk/matplotlib/doc/api_reference/conf.py
===================================================================
--- trunk/matplotlib/doc/api_reference/conf.py 2008-05-23 14:53:33 UTC (rev 5227)
+++ trunk/matplotlib/doc/api_reference/conf.py 2008-05-23 16:12:50 UTC (rev 5228)
@@ -23,7 +23,7 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['mathml', 'sphinx.ext.autodoc']
+extensions = ['mathpng', 'sphinx.ext.autodoc']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Modified: trunk/matplotlib/doc/sphinxext/mathpng.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/mathpng.py 2008-05-23 14:53:33 UTC (rev 5227)
+++ trunk/matplotlib/doc/sphinxext/mathpng.py 2008-05-23 16:12:50 UTC (rev 5228)
@@ -95,7 +95,11 @@
os.system('latex --interaction=nonstopmode math.tex > /dev/null')
os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' +
'-o _static/%s.png math.dvi > /dev/null' % name)
- path = source.split('/doc/')[-1].count('/') * '../' + '_static'
+ path = '_static'
+ count = source.split('/doc/')[-1].count('/')
+ for i in range(count):
+ if os.path.exists(path): break
+ path = '../'+path
if inline and '_' in latex:
align = 'align="absmiddle" '
else:
Modified: trunk/matplotlib/doc/users_guide/conf.py
===================================================================
--- trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 14:53:33 UTC (rev 5227)
+++ trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 16:12:50 UTC (rev 5228)
@@ -27,7 +27,7 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['mathml', 'sphinx.ext.autodoc']
+extensions = ['mathpng', 'sphinx.ext.autodoc']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Modified: trunk/matplotlib/doc/users_guide/documenting_mpl.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/documenting_mpl.txt 2008-05-23 14:53:33 UTC (rev 5227)
+++ trunk/matplotlib/doc/users_guide/documenting_mpl.txt 2008-05-23 16:12:50 UTC (rev 5228)
@@ -4,8 +4,7 @@
The documentation for matplotlib is generated from ReStructured Text
using the Sphinx_ documentation generation tool. Sphinx-0.4 or later
-is required to generate xml files to render mathematical expressions
-with mathml. Currently this means we need to install from the svn
+is required. Currently this means we need to install from the svn
repository by doing::
svn co http://svn.python.org/projects/doctools/trunk sphinx
@@ -34,10 +33,25 @@
gets its contents from the CODING_GUIDE file in the trunk:
``.. include:: ../../CODING_GUIDE``.
+Mathematical expressions can be rendered as png images in html, and in
+the usual way by latex. For example:
+
+``math:`sin(x_n^2)`` yields: :math:`sin(x_n^2)`, and::
+
+ .. math::
+
+ \int_{-\infty}^{\infty}\frac{e^{i\phi}}{1+x^2\frac{e^{i\phi}}{1+x^2}}``
+
+yields:
+
+.. math::
+
+ \int_{-\infty}^{\infty}\frac{e^{i\phi}}{1+x^2\frac{e^{i\phi}}{1+x^2}}
+
The output produced by Sphinx can be configured by editing the conf.py
files located in the documentation source directories.
The Sphinx website contains plenty of documentation_ concerning ReST
markup and working with Sphinx in general.
-.. _documentation: http://sphinx.pocoo.org/contents.html
\ No newline at end of file
+.. _documentation: http://sphinx.pocoo.org/contents.html
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-23 14:53:40
|
Revision: 5227
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5227&view=rev
Author: mdboom
Date: 2008-05-23 07:53:33 -0700 (Fri, 23 May 2008)
Log Message:
-----------
Add support for syntax-highlighting ipython console sessions.
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/artist_api_tut.txt
trunk/matplotlib/doc/users_guide/conf.py
Added Paths:
-----------
trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py
Added: trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py (rev 0)
+++ trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py 2008-05-23 14:53:33 UTC (rev 5227)
@@ -0,0 +1,75 @@
+from pygments.lexer import Lexer, do_insertions
+from pygments.lexers.agile import PythonConsoleLexer, PythonLexer, \
+ PythonTracebackLexer
+from pygments.token import Comment, Generic
+from sphinx import highlighting
+import re
+
+line_re = re.compile('.*?\n')
+
+class IPythonConsoleLexer(Lexer):
+ """
+ For IPython console output or doctests, such as:
+
+ Tracebacks are not currently supported.
+
+ .. sourcecode:: pycon
+
+ In [1]: a = 'foo'
+
+ In [2]: a
+ Out[2]: 'foo'
+
+ In [3]: print a
+ foo
+
+ In [4]: 1 / 0
+ """
+ name = 'IPython console session'
+ aliases = ['ipython']
+ mimetypes = ['text/x-ipython-console']
+ input_prompt = re.compile("(In \[[0-9]+\]: )|( \.\.\.+:)")
+ output_prompt = re.compile("(Out\[[0-9]+\]: )|( \.\.\.+:)")
+ continue_prompt = re.compile(" \.\.\.+:")
+ tb_start = re.compile("\-+")
+
+ def get_tokens_unprocessed(self, text):
+ pylexer = PythonLexer(**self.options)
+ tblexer = PythonTracebackLexer(**self.options)
+
+ curcode = ''
+ insertions = []
+ for match in line_re.finditer(text):
+ line = match.group()
+ input_prompt = self.input_prompt.match(line)
+ continue_prompt = self.continue_prompt.match(line.rstrip())
+ output_prompt = self.output_prompt.match(line)
+ if line.startswith("#"):
+ insertions.append((len(curcode),
+ [(0, Comment, line)]))
+ elif input_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt, input_prompt.group())]))
+ curcode += line[input_prompt.end():]
+ elif continue_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt, continue_prompt.group())]))
+ curcode += line[continue_prompt.end():]
+ elif output_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Output, output_prompt.group())]))
+ curcode += line[output_prompt.end():]
+ else:
+ if curcode:
+ for item in do_insertions(insertions,
+ pylexer.get_tokens_unprocessed(curcode)):
+ yield item
+ curcode = ''
+ insertions = []
+ yield match.start(), Generic.Output, line
+ if curcode:
+ for item in do_insertions(insertions,
+ pylexer.get_tokens_unprocessed(curcode)):
+ yield item
+
+highlighting.lexers['ipython'] = IPythonConsoleLexer()
Modified: trunk/matplotlib/doc/users_guide/artist_api_tut.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 14:37:51 UTC (rev 5226)
+++ trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 14:53:33 UTC (rev 5227)
@@ -61,8 +61,10 @@
Axes) and when you call ax.plot, it creates a Line2D instance and adds
it the the Axes.lines list. In the interactive ipython session below,
you can see that Axes.lines list is length one and contains the same
-line that was returned by the "line, ax.plot(x, y, 'o')" call::
+line that was returned by the "line, ax.plot(x, y, 'o')" call:
+.. sourcecode:: ipython
+
In [101]: ax.lines[0]
Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710>
@@ -159,8 +161,9 @@
inspect the artist properties is to use the matplotlib.artist.getp
method, which lists the properties and their values (simply "getp") in
pylab. This works for classes derived from Artist as well, eg Figure
-and Rectangle. Here are the Figure rectangle properties mentioned above::
+and Rectangle. Here are the Figure rectangle properties mentioned above:
+.. sourcecode:: ipython
In [149]: matplotlib.artist.getp(fig.figurePatch)
alpha = 1.0
@@ -218,8 +221,10 @@
Rectangle which is stored in fig.figurePatch (where fig is your Figure
instance). As you add subplots (fig.add_subplot) and axes
(ax.add_axes)to the figure these will be appended to the fig.axes
-list. These are also returned by the methods that create them::
+list. These are also returned by the methods that create them:
+.. sourcecode:: ipython
+
In [156]: fig = plt.figure()
In [157]: ax1 = fig.add_subplot(211)
@@ -232,7 +237,6 @@
In [160]: print fig.axes
[<matplotlib.axes.Subplot instance at 0xd54b26c>, <matplotlib.axes.Axes instance at 0xd3f0b2c>]
-
Because the figure maintains the concept of the "current axes" (see
Figure.gca and Figure.sca) to support the pylab/pyplot state machine,
you should not insert or remove axes directly from the axes list, but
@@ -253,8 +257,10 @@
the Artist you are adding to the figure. More useful is "figure
coordinates" where 0,0 is the bottom, left of the figure and 1,1 is
the top, right of the figure which you can obtain by setting the
-Artist transform to fig.transFigure::
+Artist transform to fig.transFigure:
+.. sourcecode:: ipython
+
In [191]: fig = plt.figure()
In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
@@ -303,8 +309,10 @@
in arrays or list of values, the method will a matplotlib.lines.Line2D
instance, update the line with all the Line2D properties passed as
keyword arguments, add the line to the Axes.lines container, and
-returns it to you::
+returns it to you:
+.. sourcecode:: ipython
+
In [213]: x, y = np.random.rand(2, 100)
In [214]: line, = ax.plot(x, y, '-', color='blue', linewidth=2)
@@ -312,15 +320,18 @@
ax.plot returns a list of lines because you can pass in multiple x, y
pairs to plot, and we are unpacking the first element of the length
one list into the line variable. The line has been added to the
-ax.lines list::
+ax.lines list:
+.. sourcecode:: ipython
In [229]: print ax.lines
[<matplotlib.lines.Line2D instance at 0xd378b0c>]
Similarly, methods that create patches, like ax.bar creates a list of
-rectangles, will add the patches to the ax.patches list::
+rectangles, will add the patches to the ax.patches list:
+.. sourcecode:: ipython
+
In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow')
In [234]: rectangles
@@ -338,8 +349,10 @@
plotted data. You can, nonetheless, create objects yourself and add
them directly to the Axes using helper methods like ax.add_line and
ax.add_patch. Here is an annotated interactive session illustrating
-what is going on::
+what is going on:
+.. sourcecode:: ipython
+
In [261]: fig = plt.figure()
In [262]: ax = fig.add_subplot(111)
@@ -460,8 +473,10 @@
through their accessor methods axis.get_major_ticks() and
axis.get_minor_ticks(). Although the ticks contain all the primitives
and will be covered below, the Axis methods contain accessor methods
-to return the tick lines, tick labels, tick locations etc....::
+to return the tick lines, tick labels, tick locations etc....:
+.. sourcecode:: ipython
+
In [285]: axis = ax.xaxis
In [286]: axis.get_ticklocs()
Modified: trunk/matplotlib/doc/users_guide/conf.py
===================================================================
--- trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 14:37:51 UTC (rev 5226)
+++ trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 14:53:33 UTC (rev 5227)
@@ -18,6 +18,10 @@
# absolute, like shown here.
sys.path.append(os.path.abspath('../sphinxext'))
+# Import support for ipython console session syntax highlighting (lives
+# in the sphinxext directory defined above)
+import ipython_console_highlighting
+
# General configuration
# ---------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-23 14:37:59
|
Revision: 5226
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5226&view=rev
Author: dsdale
Date: 2008-05-23 07:37:51 -0700 (Fri, 23 May 2008)
Log Message:
-----------
use mathpng extension rather than mathml
generate html rather than xml
Modified Paths:
--------------
trunk/matplotlib/doc/api_reference/conf.py
trunk/matplotlib/doc/api_reference/make.py
trunk/matplotlib/doc/users_guide/coding_guide.txt
trunk/matplotlib/doc/users_guide/conf.py
Added Paths:
-----------
trunk/matplotlib/doc/sphinxext/mathpng.py
Removed Paths:
-------------
trunk/matplotlib/doc/CODING_GUIDE
Deleted: trunk/matplotlib/doc/CODING_GUIDE
===================================================================
--- trunk/matplotlib/doc/CODING_GUIDE 2008-05-23 14:13:16 UTC (rev 5225)
+++ trunk/matplotlib/doc/CODING_GUIDE 2008-05-23 14:37:51 UTC (rev 5226)
@@ -1,317 +0,0 @@
-***************
-Version Control
-***************
-
-svn checkouts
-=============
-
-Checking out everything in the trunk (matplotlib and toolkits)::
-
- svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk \
- matplotlib --username=youruser --password=yourpass
-
-Checking out the main source::
-
- svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/\
- matplotlib matplotlib --username=youruser --password=yourpass
-
-Branch checkouts, eg the maintenance branch::
-
- svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\
- v0_91_maint mplv0_91_maint
-
-Committing changes
-==================
-
-When committing changes to matplotlib, there are a few things to bear
-in mind.
-
-* if your changes are non-trivial, please make an entry in the
- CHANGELOG
-* if you change the API, please document it in API_CHANGES, and
- consider posting to mpl-devel
-* Are your changes python2.3 compatible? We are still trying to
- support 2.3, so avoid 2.4 only features like decorators until we
- remove 2.3 support
-* Can you pass examples/backend_driver.py? This is our poor man's
- unit test.
-* If you have altered extension code, do you pass
- unit/memleak_hawaii.py?
-* if you have added new files or directories, or reorganized
- existing ones, are the new files included in the match patterns in
- MANIFEST.in. This file determines what goes into the src
- distribution of the mpl build.
-* Keep the maintenance branch and trunk in sync where it makes sense.
- If there is a bug on both that needs fixing, use svnmerge.py to
- keep them in sync. http://www.orcaware.com/svn/wiki/Svnmerge.py. The
- basic procedure is:
-
- * install svnmerge.py in your PATH::
-
- wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/\
- svnmerge/svnmerge.py
-
- * get a svn copy of the maintenance branch and the trunk (see above)
- * Michael advises making the change on the branch and committing
- it. Make sure you svn upped on the trunk and have no local
- modifications, and then from the svn trunk do::
-
- > svnmerge.py merge -rNNN1,NNN2
-
- where the NNN* are the revision numbers. Ranges arealso acceptable.
- svnmergy.py automatically creates a file containing the commit messages,
- so you are ready to make the commit::
-
- > svn commit -F svnmerge-commit-message.txt
-
-***********
-Style Guide
-***********
-
-Importing and name spaces
-=========================
-
-For numpy, use::
-
- import numpy as np
- a = np.array([1,2,3])
-
-For masked arrays, use::
-
- from numpy import ma
-
-(The earlier recommendation, 'import matplotlib.numerix.npyma as ma',
-was needed temporarily during the development of the maskedarray
-implementation as a separate package. As of numpy 1.1, it replaces the
-old implementation. Note: "from numpy import ma" works with numpy < 1.1
-*and* with numpy >= 1.1. "import numpy.ma as ma" works *only* with
-numpy >= 1.1, so for now we must not use it.)
-
-For matplotlib main module, use::
-
- import matplotlib as mpl
- mpl.rcParams['xtick.major.pad'] = 6
-
-For matplotlib modules (or any other modules), use::
-
- import matplotlib.cbook as cbook
-
- if cbook.iterable(z):
- pass
-
-We prefer this over the equivalent 'from matplotlib import cbook'
-because the latter is ambiguous whether cbook is a module or a
-function to the new developer. The former makes it explcit that
-you are importing a module or package.
-
-Naming, spacing, and formatting conventions
-===========================================
-
-In general, we want to hew as closely as possible to the standard
-coding guidelines for python written by Guido in
-http://www.python.org/dev/peps/pep-0008, though we do not do this
-throughout.
-
-* functions and class methods: lower or lower_underscore_separated
-
-* attributes and variables: lower or lowerUpper
-
-* classes: Upper or MixedCase
-
-Personally, I prefer the shortest names that are still readable.
-
-Also, use an editor that does not put tabs in files. Four spaces
-should be used for indentation everywhere and if there is a file with
-tabs or more or less spaces it is a bug -- please fix it.
-
-Please avoid spurious invisible spaces at the ends of lines.
-(Tell your editor to strip whitespace from line ends when saving
-a file.)
-
-Keep docstrings uniformly indented as in the example below, with
-nothing to the left of the triple quotes. The dedent() function
-is needed to remove excess indentation only if something will be
-interpolated into the docstring, again as in the example above.
-
-Limit line length to 80 characters. If a logical line needs to be
-longer, use parentheses to break it; do not use an escaped
-newline. It may be preferable to use a temporary variable
-to replace a single long line with two shorter and more
-readable lines.
-
-Please do not commit lines with trailing white space, as it causes
-noise in svn diffs. If you are an emacs user, the following in your
-.emacs will cause emacs to strip trailing white space on save for
-python, C and C++::
-
- ; and similarly for c++-mode-hook and c-mode-hook
- (add-hook 'python-mode-hook
- (lambda ()
- (add-hook 'write-file-functions 'delete-trailing-whitespace)))
-
-for older versions of emacs (emacs<22) you need to do::
-
- (add-hook 'python-mode-hook
- (lambda ()
- (add-hook 'local-write-file-hooks 'delete-trailing-whitespace)))
-
-Keyword argument processing
-===========================
-
-Matplotlib makes extensive use of ``**kwargs`` for pass through
-customizations from one function to another. A typical example is in
-pylab.text, The definition of the pylab text function is a simple
-pass-through to axes.Axes.text::
-
- # in pylab.py
- def text(*args, **kwargs):
- ret = gca().text(*args, **kwargs)
- draw_if_interactive()
- return ret
-
-axes.Axes.text in simplified form looks like this, ie it just passes
-them on to text.Text.__init__::
-
- # in axes.py
- def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
- t = Text(x=x, y=y, text=s, **kwargs)
-
-and Text.__init__ (again with liberties for illustration) just passes
-them on to the artist.Artist.update method::
-
- # in text.py
- def __init__(self, x=0, y=0, text='', **kwargs):
- Artist.__init__(self)
- self.update(kwargs)
-
-'update' does the work looking for methods named like 'set_property'
-if 'property' is a keyword argument. Ie, noone looks at the keywords,
-they just get passed through the API to the artist constructor which
-looks for suitably named methods and calls them with the value.
-
-As a general rule, the use of ``**kwargs`` should be reserved for
-pass-through keyword arguments, as in the examaple above. If I intend
-for all the keyword args to be used in some function and not passed
-on, I just use the key/value keyword args in the function definition
-rather than the ``**kwargs`` idiom.
-
-In some cases I want to consume some keys and pass through the others,
-in which case I pop the ones I want to use locally and pass on the
-rest, eg I pop scalex and scaley in Axes.plot and assume the rest are
-Line2D keyword arguments. As an example of a pop, passthrough
-usage, see Axes.plot::
-
- # in axes.py
- def plot(self, *args, **kwargs):
- scalex = kwargs.pop('scalex', True)
- scaley = kwargs.pop('scaley', True)
- if not self._hold: self.cla()
- lines = []
- for line in self._get_lines(*args, **kwargs):
- self.add_line(line)
- lines.append(line)
-
-The matplotlib.cbook function popd() is rendered
-obsolete by the pop() dictionary method introduced in Python 2.3,
-so it should not be used for new code.
-
-Note there is a use case when kwargs are meant to be used locally in
-the function (not passed on), but you still need the ``**kwargs`` idiom.
-That is when you want to use ``*args`` to allow variable numbers of
-non-keyword args. In this case, python will not allow you to use
-named keyword args after the ``*args`` usage, so you will be forced to use
-``**kwargs``. An example is matplotlib.contour.ContourLabeler.clabel::
-
- # in contour.py
- def clabel(self, *args, **kwargs):
- fontsize = kwargs.get('fontsize', None)
- inline = kwargs.get('inline', 1)
- self.fmt = kwargs.get('fmt', '%1.3f')
- colors = kwargs.get('colors', None)
- if len(args) == 0:
- levels = self.levels
- indices = range(len(self.levels))
- elif len(args) == 1:
- ...etc...
-
-Documentation and Docstrings
-============================
-
-matplotlib uses artist instrospection of docstrings to support
-properties. All properties that you want to support through setp and
-getp should have a set_property and get_property method in the Artist
-class. Yes, this is not ideal given python properties or enthought
-traits, but it is a historical legacy for now. The setter methods use
-the docstring with the ACCEPTS token to indicate the type of argument
-the method accepts. Eg in matplotlib.lines.Line2D::
-
- # in lines.py
- def set_linestyle(self, linestyle):
- """
- Set the linestyle of the line
-
- ACCEPTS: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' | ' ' | '' ]
- """
-
-Since matplotlib uses a lot of pass through kwargs, eg in every
-function that creates a line (plot, semilogx, semilogy, etc...), it
-can be difficult for the new user to know which kwargs are supported.
-I have developed a docstring interpolation scheme to support
-documentation of every function that takes a ``**kwargs``. The
-requirements are:
-
-1. single point of configuration so changes to the properties don't
- require multiple docstring edits
-
-2. as automated as possible so that as properties change the docs
- are updated automagically.
-
-I have added a matplotlib.artist.kwdocd and kwdoc() to faciliate this.
-They combines python string interpolation in the docstring with the
-matplotlib artist introspection facility that underlies setp and getp.
-The kwdocd is a single dictionary that maps class name to a docstring
-of kwargs. Here is an example from matplotlib.lines::
-
- # in lines.py
- artist.kwdocd['Line2D'] = artist.kwdoc(Line2D)
-
-Then in any function accepting Line2D passthrough kwargs, eg
-matplotlib.axes.Axes.plot::
-
- # in axes.py
- def plot(self, *args, **kwargs):
- """
- Some stuff omitted
-
- The kwargs are Line2D properties:
- %(Line2D)s
-
- kwargs scalex and scaley, if defined, are passed on
- to autoscale_view to determine whether the x and y axes are
- autoscaled; default True. See Axes.autoscale_view for more
- information
- """
- pass
- plot.__doc__ = cbook.dedent(plot.__doc__) % artist.kwdocd
-
-Note there is a problem for Artist __init__ methods, eg Patch.__init__
-which supports Patch kwargs, since the artist inspector cannot work
-until the class is fully defined and we can't modify the
-Patch.__init__.__doc__ docstring outside the class definition. I have
-made some manual hacks in this case which violates the "single entry
-point" requirement above; hopefully we'll find a more elegant solution
-before too long
-
-********
-Licenses
-********
-
-Matplotlib only uses BSD compatible code. If you bring in code from
-another project make sure it has a PSF, BSD, MIT or compatible
-license. If not, you may consider contacting the author and asking
-them to relicense it. GPL and LGPL code are not acceptible in the
-main code base, though we are considering an alternative way of
-distributing L/GPL code through an separate channel, possibly a
-toolkit. If you include code, make sure you include a copy of that
-code's license in the license directory if the code's license requires
-you to distribute the license with it.
\ No newline at end of file
Modified: trunk/matplotlib/doc/api_reference/conf.py
===================================================================
--- trunk/matplotlib/doc/api_reference/conf.py 2008-05-23 14:13:16 UTC (rev 5225)
+++ trunk/matplotlib/doc/api_reference/conf.py 2008-05-23 14:37:51 UTC (rev 5226)
@@ -93,7 +93,7 @@
# If nonempty, this is the file name suffix for generated HTML files. The
# default is ``".html"``.
-html_file_suffix = '.xml'
+#html_file_suffix = '.xhtml'
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Modified: trunk/matplotlib/doc/api_reference/make.py
===================================================================
--- trunk/matplotlib/doc/api_reference/make.py 2008-05-23 14:13:16 UTC (rev 5225)
+++ trunk/matplotlib/doc/api_reference/make.py 2008-05-23 14:37:51 UTC (rev 5226)
@@ -15,7 +15,7 @@
pass
def figs():
- os.system('cd source/figures/ && python make.py')
+ os.system('cd figures/ && python make.py')
def html():
check_build()
Added: trunk/matplotlib/doc/sphinxext/mathpng.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/mathpng.py (rev 0)
+++ trunk/matplotlib/doc/sphinxext/mathpng.py 2008-05-23 14:37:51 UTC (rev 5226)
@@ -0,0 +1,107 @@
+import os
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
+from docutils import nodes
+from docutils.writers.html4css1 import HTMLTranslator
+from sphinx.latexwriter import LaTeXTranslator
+
+# Define LaTeX math node:
+class latex_math(nodes.General, nodes.Element):
+ pass
+
+def math_role(role, rawtext, text, lineno, inliner,
+ options={}, content=[]):
+ i = rawtext.find('`')
+ latex = rawtext[i+1:-1]
+ node = latex_math(rawtext)
+ node['latex'] = latex
+ return [node], []
+
+
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ # Register directive the old way:
+ from docutils.parsers.rst.directives import _directives
+ def math_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ latex = ''.join(content)
+ node = latex_math(block_text)
+ node['latex'] = latex
+ return [node]
+ math_directive.arguments = None
+ math_directive.options = {}
+ math_directive.content = 1
+ _directives['math'] = math_directive
+else:
+ class math_directive(Directive):
+ has_content = True
+ def run(self):
+ latex = ' '.join(self.content)
+ node = latex_math(self.block_text)
+ node['latex'] = latex
+ return [node]
+ from docutils.parsers.rst import directives
+ directives.register_directive('math', math_directive)
+
+def setup(app):
+ app.add_node(latex_math)
+ app.add_role('math', math_role)
+
+ # Add visit/depart methods to HTML-Translator:
+ def visit_latex_math_html(self, node):
+ source = self.document.attributes['source']
+ self.body.append(latex2html(node, source))
+ def depart_latex_math_html(self, node):
+ pass
+ HTMLTranslator.visit_latex_math = visit_latex_math_html
+ HTMLTranslator.depart_latex_math = depart_latex_math_html
+
+ # Add visit/depart methods to LaTeX-Translator:
+ def visit_latex_math_latex(self, node):
+ inline = isinstance(node.parent, nodes.TextElement)
+ if inline:
+ self.body.append('$%s$' % node['latex'])
+ else:
+ self.body.extend(['\\begin{equation}',
+ node['latex'],
+ '\\end{equation}'])
+ def depart_latex_math_latex(self, node):
+ pass
+ LaTeXTranslator.visit_latex_math = visit_latex_math_latex
+ LaTeXTranslator.depart_latex_math = depart_latex_math_latex
+
+from os.path import isfile
+# LaTeX to HTML translation stuff:
+def latex2html(node, source):
+ inline = isinstance(node.parent, nodes.TextElement)
+ latex = node['latex']
+ print latex
+ name = 'math-' + md5(latex).hexdigest()[-10:]
+ if not isfile('_static/%s.png' % name):
+ f = open('math.tex', 'w')
+ f.write(r"""\documentclass[12pt]{article}
+ \pagestyle{empty}
+ \begin{document}""")
+ if inline:
+ f.write('$%s$' % latex)
+ else:
+ f.write(r'\[ %s \]' % latex)
+ f.write('\end{document}')
+ f.close()
+ os.system('latex --interaction=nonstopmode math.tex > /dev/null')
+ os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' +
+ '-o _static/%s.png math.dvi > /dev/null' % name)
+ path = source.split('/doc/')[-1].count('/') * '../' + '_static'
+ if inline and '_' in latex:
+ align = 'align="absmiddle" '
+ else:
+ align = ''
+ if inline:
+ cls = ''
+ else:
+ cls = 'class="center" '
+ return '<img src="%s/%s.png" %s%s/>' % (path, name, align, cls)
Property changes on: trunk/matplotlib/doc/sphinxext/mathpng.py
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/matplotlib/doc/users_guide/coding_guide.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/coding_guide.txt 2008-05-23 14:13:16 UTC (rev 5225)
+++ trunk/matplotlib/doc/users_guide/coding_guide.txt 2008-05-23 14:37:51 UTC (rev 5226)
@@ -1,3 +1,317 @@
+***************
+Version Control
+***************
-.. include:: ../../CODING_GUIDE
+svn checkouts
+=============
+Checking out everything in the trunk (matplotlib and toolkits)::
+
+ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk \
+ matplotlib --username=youruser --password=yourpass
+
+Checking out the main source::
+
+ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/\
+ matplotlib matplotlib --username=youruser --password=yourpass
+
+Branch checkouts, eg the maintenance branch::
+
+ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\
+ v0_91_maint mplv0_91_maint
+
+Committing changes
+==================
+
+When committing changes to matplotlib, there are a few things to bear
+in mind.
+
+* if your changes are non-trivial, please make an entry in the
+ CHANGELOG
+* if you change the API, please document it in API_CHANGES, and
+ consider posting to mpl-devel
+* Are your changes python2.3 compatible? We are still trying to
+ support 2.3, so avoid 2.4 only features like decorators until we
+ remove 2.3 support
+* Can you pass examples/backend_driver.py? This is our poor man's
+ unit test.
+* If you have altered extension code, do you pass
+ unit/memleak_hawaii.py?
+* if you have added new files or directories, or reorganized
+ existing ones, are the new files included in the match patterns in
+ MANIFEST.in. This file determines what goes into the src
+ distribution of the mpl build.
+* Keep the maintenance branch and trunk in sync where it makes sense.
+ If there is a bug on both that needs fixing, use svnmerge.py to
+ keep them in sync. http://www.orcaware.com/svn/wiki/Svnmerge.py. The
+ basic procedure is:
+
+ * install svnmerge.py in your PATH::
+
+ wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/\
+ svnmerge/svnmerge.py
+
+ * get a svn copy of the maintenance branch and the trunk (see above)
+ * Michael advises making the change on the branch and committing
+ it. Make sure you svn upped on the trunk and have no local
+ modifications, and then from the svn trunk do::
+
+ > svnmerge.py merge -rNNN1,NNN2
+
+ where the NNN* are the revision numbers. Ranges arealso acceptable.
+ svnmergy.py automatically creates a file containing the commit messages,
+ so you are ready to make the commit::
+
+ > svn commit -F svnmerge-commit-message.txt
+
+***********
+Style Guide
+***********
+
+Importing and name spaces
+=========================
+
+For numpy, use::
+
+ import numpy as np
+ a = np.array([1,2,3])
+
+For masked arrays, use::
+
+ from numpy import ma
+
+(The earlier recommendation, 'import matplotlib.numerix.npyma as ma',
+was needed temporarily during the development of the maskedarray
+implementation as a separate package. As of numpy 1.1, it replaces the
+old implementation. Note: "from numpy import ma" works with numpy < 1.1
+*and* with numpy >= 1.1. "import numpy.ma as ma" works *only* with
+numpy >= 1.1, so for now we must not use it.)
+
+For matplotlib main module, use::
+
+ import matplotlib as mpl
+ mpl.rcParams['xtick.major.pad'] = 6
+
+For matplotlib modules (or any other modules), use::
+
+ import matplotlib.cbook as cbook
+
+ if cbook.iterable(z):
+ pass
+
+We prefer this over the equivalent 'from matplotlib import cbook'
+because the latter is ambiguous whether cbook is a module or a
+function to the new developer. The former makes it explcit that
+you are importing a module or package.
+
+Naming, spacing, and formatting conventions
+===========================================
+
+In general, we want to hew as closely as possible to the standard
+coding guidelines for python written by Guido in
+http://www.python.org/dev/peps/pep-0008, though we do not do this
+throughout.
+
+* functions and class methods: lower or lower_underscore_separated
+
+* attributes and variables: lower or lowerUpper
+
+* classes: Upper or MixedCase
+
+Personally, I prefer the shortest names that are still readable.
+
+Also, use an editor that does not put tabs in files. Four spaces
+should be used for indentation everywhere and if there is a file with
+tabs or more or less spaces it is a bug -- please fix it.
+
+Please avoid spurious invisible spaces at the ends of lines.
+(Tell your editor to strip whitespace from line ends when saving
+a file.)
+
+Keep docstrings uniformly indented as in the example below, with
+nothing to the left of the triple quotes. The dedent() function
+is needed to remove excess indentation only if something will be
+interpolated into the docstring, again as in the example above.
+
+Limit line length to 80 characters. If a logical line needs to be
+longer, use parentheses to break it; do not use an escaped
+newline. It may be preferable to use a temporary variable
+to replace a single long line with two shorter and more
+readable lines.
+
+Please do not commit lines with trailing white space, as it causes
+noise in svn diffs. If you are an emacs user, the following in your
+.emacs will cause emacs to strip trailing white space on save for
+python, C and C++::
+
+ ; and similarly for c++-mode-hook and c-mode-hook
+ (add-hook 'python-mode-hook
+ (lambda ()
+ (add-hook 'write-file-functions 'delete-trailing-whitespace)))
+
+for older versions of emacs (emacs<22) you need to do::
+
+ (add-hook 'python-mode-hook
+ (lambda ()
+ (add-hook 'local-write-file-hooks 'delete-trailing-whitespace)))
+
+Keyword argument processing
+===========================
+
+Matplotlib makes extensive use of ``**kwargs`` for pass through
+customizations from one function to another. A typical example is in
+pylab.text, The definition of the pylab text function is a simple
+pass-through to axes.Axes.text::
+
+ # in pylab.py
+ def text(*args, **kwargs):
+ ret = gca().text(*args, **kwargs)
+ draw_if_interactive()
+ return ret
+
+axes.Axes.text in simplified form looks like this, ie it just passes
+them on to text.Text.__init__::
+
+ # in axes.py
+ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
+ t = Text(x=x, y=y, text=s, **kwargs)
+
+and Text.__init__ (again with liberties for illustration) just passes
+them on to the artist.Artist.update method::
+
+ # in text.py
+ def __init__(self, x=0, y=0, text='', **kwargs):
+ Artist.__init__(self)
+ self.update(kwargs)
+
+'update' does the work looking for methods named like 'set_property'
+if 'property' is a keyword argument. Ie, noone looks at the keywords,
+they just get passed through the API to the artist constructor which
+looks for suitably named methods and calls them with the value.
+
+As a general rule, the use of ``**kwargs`` should be reserved for
+pass-through keyword arguments, as in the examaple above. If I intend
+for all the keyword args to be used in some function and not passed
+on, I just use the key/value keyword args in the function definition
+rather than the ``**kwargs`` idiom.
+
+In some cases I want to consume some keys and pass through the others,
+in which case I pop the ones I want to use locally and pass on the
+rest, eg I pop scalex and scaley in Axes.plot and assume the rest are
+Line2D keyword arguments. As an example of a pop, passthrough
+usage, see Axes.plot::
+
+ # in axes.py
+ def plot(self, *args, **kwargs):
+ scalex = kwargs.pop('scalex', True)
+ scaley = kwargs.pop('scaley', True)
+ if not self._hold: self.cla()
+ lines = []
+ for line in self._get_lines(*args, **kwargs):
+ self.add_line(line)
+ lines.append(line)
+
+The matplotlib.cbook function popd() is rendered
+obsolete by the pop() dictionary method introduced in Python 2.3,
+so it should not be used for new code.
+
+Note there is a use case when kwargs are meant to be used locally in
+the function (not passed on), but you still need the ``**kwargs`` idiom.
+That is when you want to use ``*args`` to allow variable numbers of
+non-keyword args. In this case, python will not allow you to use
+named keyword args after the ``*args`` usage, so you will be forced to use
+``**kwargs``. An example is matplotlib.contour.ContourLabeler.clabel::
+
+ # in contour.py
+ def clabel(self, *args, **kwargs):
+ fontsize = kwargs.get('fontsize', None)
+ inline = kwargs.get('inline', 1)
+ self.fmt = kwargs.get('fmt', '%1.3f')
+ colors = kwargs.get('colors', None)
+ if len(args) == 0:
+ levels = self.levels
+ indices = range(len(self.levels))
+ elif len(args) == 1:
+ ...etc...
+
+Documentation and Docstrings
+============================
+
+matplotlib uses artist instrospection of docstrings to support
+properties. All properties that you want to support through setp and
+getp should have a set_property and get_property method in the Artist
+class. Yes, this is not ideal given python properties or enthought
+traits, but it is a historical legacy for now. The setter methods use
+the docstring with the ACCEPTS token to indicate the type of argument
+the method accepts. Eg in matplotlib.lines.Line2D::
+
+ # in lines.py
+ def set_linestyle(self, linestyle):
+ """
+ Set the linestyle of the line
+
+ ACCEPTS: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' | ' ' | '' ]
+ """
+
+Since matplotlib uses a lot of pass through kwargs, eg in every
+function that creates a line (plot, semilogx, semilogy, etc...), it
+can be difficult for the new user to know which kwargs are supported.
+I have developed a docstring interpolation scheme to support
+documentation of every function that takes a ``**kwargs``. The
+requirements are:
+
+1. single point of configuration so changes to the properties don't
+ require multiple docstring edits
+
+2. as automated as possible so that as properties change the docs
+ are updated automagically.
+
+I have added a matplotlib.artist.kwdocd and kwdoc() to faciliate this.
+They combines python string interpolation in the docstring with the
+matplotlib artist introspection facility that underlies setp and getp.
+The kwdocd is a single dictionary that maps class name to a docstring
+of kwargs. Here is an example from matplotlib.lines::
+
+ # in lines.py
+ artist.kwdocd['Line2D'] = artist.kwdoc(Line2D)
+
+Then in any function accepting Line2D passthrough kwargs, eg
+matplotlib.axes.Axes.plot::
+
+ # in axes.py
+ def plot(self, *args, **kwargs):
+ """
+ Some stuff omitted
+
+ The kwargs are Line2D properties:
+ %(Line2D)s
+
+ kwargs scalex and scaley, if defined, are passed on
+ to autoscale_view to determine whether the x and y axes are
+ autoscaled; default True. See Axes.autoscale_view for more
+ information
+ """
+ pass
+ plot.__doc__ = cbook.dedent(plot.__doc__) % artist.kwdocd
+
+Note there is a problem for Artist __init__ methods, eg Patch.__init__
+which supports Patch kwargs, since the artist inspector cannot work
+until the class is fully defined and we can't modify the
+Patch.__init__.__doc__ docstring outside the class definition. I have
+made some manual hacks in this case which violates the "single entry
+point" requirement above; hopefully we'll find a more elegant solution
+before too long
+
+********
+Licenses
+********
+
+Matplotlib only uses BSD compatible code. If you bring in code from
+another project make sure it has a PSF, BSD, MIT or compatible
+license. If not, you may consider contacting the author and asking
+them to relicense it. GPL and LGPL code are not acceptible in the
+main code base, though we are considering an alternative way of
+distributing L/GPL code through an separate channel, possibly a
+toolkit. If you include code, make sure you include a copy of that
+code's license in the license directory if the code's license requires
+you to distribute the license with it.
\ No newline at end of file
Modified: trunk/matplotlib/doc/users_guide/conf.py
===================================================================
--- trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 14:13:16 UTC (rev 5225)
+++ trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 14:37:51 UTC (rev 5226)
@@ -93,7 +93,7 @@
# If nonempty, this is the file name suffix for generated HTML files. The
# default is ``".html"``.
-html_file_suffix = '.xml'
+#html_file_suffix = '.xhtml'
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-23 14:13:21
|
Revision: 5225
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5225&view=rev
Author: jdh2358
Date: 2008-05-23 07:13:16 -0700 (Fri, 23 May 2008)
Log Message:
-----------
removed old make
Removed Paths:
-------------
trunk/matplotlib/doc/make.py
Deleted: trunk/matplotlib/doc/make.py
===================================================================
--- trunk/matplotlib/doc/make.py 2008-05-23 13:59:49 UTC (rev 5224)
+++ trunk/matplotlib/doc/make.py 2008-05-23 14:13:16 UTC (rev 5225)
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-import os, sys, glob
-
-def check_png():
- if not len(glob.glob('figures/*.png')):
- raise SystemExit('No PNG files in figures dir; please run make.py in the figures directory first')
-
-def check_rst2latex():
- sin, sout = os.popen2('which rst2latex')
- if not sout.read():
- raise SystemExit('Build requires rst2latex')
-
-def check_pdflatex():
- sin, sout = os.popen2('which pdflatex')
- if not sout.read():
- raise SystemExit('Build requires pdflatex')
-
-
-
-
-def artist_tut():
- check_png()
- check_rst2latex()
- check_pdflatex()
- os.system('rst2latex artist_api_tut.txt > artist_api_tut.tex')
- os.system('pdflatex artist_api_tut.tex')
-
-
-def event_tut():
- check_png()
- check_rst2latex()
- check_pdflatex()
- os.system('rst2latex event_handling_tut.txt > event_handling_tut.tex')
- os.system('pdflatex event_handling_tut.tex')
-
-def clean():
- patterns = ['#*', '*~', '*.tex', '*.log', '*.out', '*.aux', '*.pdf']
- for pattern in patterns:
- for fname in glob.glob(pattern):
- os.remove(fname)
- print 'all clean'
-
-def all():
- artist_tut()
- event_tut()
-
-funcd = {'artist_tut': artist_tut,
- 'event_tut': event_tut,
- '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()
-
-
-
-
-
-
-
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-23 13:59:50
|
Revision: 5224
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5224&view=rev
Author: dsdale
Date: 2008-05-23 06:59:49 -0700 (Fri, 23 May 2008)
Log Message:
-----------
renamed users_guide.txt and developers_guide.txt, use underscores
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/index.txt
Added Paths:
-----------
trunk/matplotlib/doc/users_guide/developers_guide.txt
trunk/matplotlib/doc/users_guide/users_guide.txt
Removed Paths:
-------------
trunk/matplotlib/doc/users_guide/developerguide.txt
trunk/matplotlib/doc/users_guide/userguide.txt
Deleted: trunk/matplotlib/doc/users_guide/developerguide.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/developerguide.txt 2008-05-23 13:52:26 UTC (rev 5223)
+++ trunk/matplotlib/doc/users_guide/developerguide.txt 2008-05-23 13:59:49 UTC (rev 5224)
@@ -1,12 +0,0 @@
-############################
-Matplotlib Developers Guide
-############################
-
-.. _contents:
-
-.. toctree::
- :maxdepth: 3
-
- coding_guide
- documenting_mpl
- add_new_projection
Copied: trunk/matplotlib/doc/users_guide/developers_guide.txt (from rev 5222, trunk/matplotlib/doc/users_guide/developerguide.txt)
===================================================================
--- trunk/matplotlib/doc/users_guide/developers_guide.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/developers_guide.txt 2008-05-23 13:59:49 UTC (rev 5224)
@@ -0,0 +1,12 @@
+############################
+Matplotlib Developers Guide
+############################
+
+.. _contents:
+
+.. toctree::
+ :maxdepth: 3
+
+ coding_guide
+ documenting_mpl
+ add_new_projection
Modified: trunk/matplotlib/doc/users_guide/index.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/index.txt 2008-05-23 13:52:26 UTC (rev 5223)
+++ trunk/matplotlib/doc/users_guide/index.txt 2008-05-23 13:59:49 UTC (rev 5224)
@@ -10,5 +10,5 @@
.. toctree::
:maxdepth: 4
- userguide
- developerguide
+ users_guide
+ developers_guide
Deleted: trunk/matplotlib/doc/users_guide/userguide.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/userguide.txt 2008-05-23 13:52:26 UTC (rev 5223)
+++ trunk/matplotlib/doc/users_guide/userguide.txt 2008-05-23 13:59:49 UTC (rev 5224)
@@ -1,12 +0,0 @@
-############
-User's Guide
-############
-
-.. _contents:
-
-.. toctree::
- :maxdepth: 3
-
- introduction
- artist_api_tut
- event_handling_tut
Copied: trunk/matplotlib/doc/users_guide/users_guide.txt (from rev 5222, trunk/matplotlib/doc/users_guide/userguide.txt)
===================================================================
--- trunk/matplotlib/doc/users_guide/users_guide.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/users_guide.txt 2008-05-23 13:59:49 UTC (rev 5224)
@@ -0,0 +1,12 @@
+############
+User's Guide
+############
+
+.. _contents:
+
+.. toctree::
+ :maxdepth: 3
+
+ introduction
+ artist_api_tut
+ event_handling_tut
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-23 13:52:37
|
Revision: 5223
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5223&view=rev
Author: dsdale
Date: 2008-05-23 06:52:26 -0700 (Fri, 23 May 2008)
Log Message:
-----------
moved api_reference docs out of source to flatten the directory structure
Modified Paths:
--------------
trunk/matplotlib/doc/api_reference/make.py
Added Paths:
-----------
trunk/matplotlib/doc/api_reference/_static/
trunk/matplotlib/doc/api_reference/_templates/
trunk/matplotlib/doc/api_reference/conf.py
trunk/matplotlib/doc/api_reference/figures/
trunk/matplotlib/doc/api_reference/index.txt
trunk/matplotlib/doc/api_reference/introduction.txt
trunk/matplotlib/doc/api_reference/latex.txt
Removed Paths:
-------------
trunk/matplotlib/doc/api_reference/source/
Copied: trunk/matplotlib/doc/api_reference/_static (from rev 5220, trunk/matplotlib/doc/api_reference/source/_static)
Property changes on: trunk/matplotlib/doc/api_reference/_static
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/matplotlib/doc/api_reference/_templates (from rev 5220, trunk/matplotlib/doc/api_reference/source/_templates)
Property changes on: trunk/matplotlib/doc/api_reference/_templates
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/matplotlib/doc/api_reference/conf.py (from rev 5220, trunk/matplotlib/doc/api_reference/source/conf.py)
===================================================================
--- trunk/matplotlib/doc/api_reference/conf.py (rev 0)
+++ trunk/matplotlib/doc/api_reference/conf.py 2008-05-23 13:52:26 UTC (rev 5223)
@@ -0,0 +1,155 @@
+# -*- coding: utf-8 -*-
+#
+# Matplotlib documentation build configuration file, created by
+# sphinx-quickstart on Fri May 2 12:33:25 2008.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default value; values that are commented out
+# serve to show the default value.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+sys.path.append(os.path.abspath('../sphinxext'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['mathml', 'sphinx.ext.autodoc']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.txt'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General substitutions.
+project = 'Matplotlib'
+copyright = '2008, John Hunter, Darren Dale'
+
+# The default replacements for |version| and |release|, also used in various
+# other places throughout the built documents.
+#
+# The short X.Y version.
+version = '0.98'
+# The full version, including alpha/beta/rc tags.
+release = '0.98pre'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# The name of an image file (within the static path) to place at the top of
+# the sidebar.
+#html_logo = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If nonempty, this is the file name suffix for generated HTML files. The
+# default is ``".html"``.
+html_file_suffix = '.xml'
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.
+html_use_opensearch = 'False'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'Matplotlib_API_doc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+latex_font_size = '11pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+ ('index', 'Matplotlib_API_Reference.tex', 'Matplotlib API Reference', 'John Hunter, Darren Dale', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+latex_logo = None
+
+# Additional stuff for the LaTeX preamble.
+latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+latex_appendices = []
+
+# If false, no module index is generated.
+latex_use_modindex = True
+
+latex_use_parts = True
Property changes on: trunk/matplotlib/doc/api_reference/conf.py
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: trunk/matplotlib/doc/api_reference/figures (from rev 5220, trunk/matplotlib/doc/api_reference/source/figures)
Property changes on: trunk/matplotlib/doc/api_reference/figures
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/matplotlib/doc/api_reference/index.txt (from rev 5220, trunk/matplotlib/doc/api_reference/source/index.txt)
===================================================================
--- trunk/matplotlib/doc/api_reference/index.txt (rev 0)
+++ trunk/matplotlib/doc/api_reference/index.txt 2008-05-23 13:52:26 UTC (rev 5223)
@@ -0,0 +1,14 @@
+.. Matplotlib documentation master file.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+.. _contents:
+
+Matplotlib API Reference
+========================
+
+.. toctree::
+ :maxdepth: 4
+
+ introduction
+ latex
Property changes on: trunk/matplotlib/doc/api_reference/index.txt
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ CRLF
Copied: trunk/matplotlib/doc/api_reference/introduction.txt (from rev 5220, trunk/matplotlib/doc/api_reference/source/introduction.txt)
===================================================================
--- trunk/matplotlib/doc/api_reference/introduction.txt (rev 0)
+++ trunk/matplotlib/doc/api_reference/introduction.txt 2008-05-23 13:52:26 UTC (rev 5223)
@@ -0,0 +1,4 @@
+************
+Introduction
+************
+
Property changes on: trunk/matplotlib/doc/api_reference/introduction.txt
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ CRLF
Copied: trunk/matplotlib/doc/api_reference/latex.txt (from rev 5220, trunk/matplotlib/doc/api_reference/source/latex.txt)
===================================================================
--- trunk/matplotlib/doc/api_reference/latex.txt (rev 0)
+++ trunk/matplotlib/doc/api_reference/latex.txt 2008-05-23 13:52:26 UTC (rev 5223)
@@ -0,0 +1,25 @@
+############################################
+Matplotlib Application Programming Interface
+############################################
+
+*************
+LaTeX Support
+*************
+
+:mod:`matplotlib.texmanager`
+=============================
+
+.. automodule:: matplotlib.texmanager
+ :members:
+
+:mod:`matplotlib.dviread`
+=============================
+
+.. automodule:: matplotlib.dviread
+ :members:
+
+:mod:`matplotlib.axes`
+=============================
+
+.. autoclass:: matplotlib.axes.Axes
+ :members: plot
\ No newline at end of file
Property changes on: trunk/matplotlib/doc/api_reference/latex.txt
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ CRLF
Modified: trunk/matplotlib/doc/api_reference/make.py
===================================================================
--- trunk/matplotlib/doc/api_reference/make.py 2008-05-23 13:49:20 UTC (rev 5222)
+++ trunk/matplotlib/doc/api_reference/make.py 2008-05-23 13:52:26 UTC (rev 5223)
@@ -7,7 +7,7 @@
def check_build():
build_dirs = ['build', 'build/doctrees', 'build/html', 'build/latex',
- 'source/_static', 'source/_templates']
+ '_static', '_templates']
for d in build_dirs:
try:
os.mkdir(d)
@@ -19,12 +19,12 @@
def html():
check_build()
- os.system('sphinx-build -b html -d build/doctrees source build/html')
+ os.system('sphinx-build -b html -d build/doctrees ./ build/html')
def latex():
if sys.platform != 'win32':
# LaTeX format.
- os.system('sphinx-build -b latex -d build/doctrees source build/latex')
+ os.system('sphinx-build -b latex -d build/doctrees ./ build/latex')
# Produce pdf.
os.chdir('build/latex')
@@ -65,4 +65,4 @@
arg, funcd.keys()))
func()
else:
- all()
\ No newline at end of file
+ all()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-23 13:49:22
|
Revision: 5222
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5222&view=rev
Author: dsdale
Date: 2008-05-23 06:49:20 -0700 (Fri, 23 May 2008)
Log Message:
-----------
moved users_guide sources out of sources, into parent directory
for flat rather than nested structure
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/make.py
Added Paths:
-----------
trunk/matplotlib/doc/users_guide/_static/
trunk/matplotlib/doc/users_guide/_templates/
trunk/matplotlib/doc/users_guide/add_new_projection.txt
trunk/matplotlib/doc/users_guide/artist_api_tut.txt
trunk/matplotlib/doc/users_guide/coding_guide.txt
trunk/matplotlib/doc/users_guide/conf.py
trunk/matplotlib/doc/users_guide/developerguide.txt
trunk/matplotlib/doc/users_guide/documenting_mpl.txt
trunk/matplotlib/doc/users_guide/event_handling_tut.txt
trunk/matplotlib/doc/users_guide/figures/
trunk/matplotlib/doc/users_guide/index.txt
trunk/matplotlib/doc/users_guide/introduction.txt
trunk/matplotlib/doc/users_guide/userguide.txt
Removed Paths:
-------------
trunk/matplotlib/doc/users_guide/source/_static/
trunk/matplotlib/doc/users_guide/source/_templates/
trunk/matplotlib/doc/users_guide/source/add_new_projection.txt
trunk/matplotlib/doc/users_guide/source/artist_api_tut.txt
trunk/matplotlib/doc/users_guide/source/coding_guide.txt
trunk/matplotlib/doc/users_guide/source/conf.py
trunk/matplotlib/doc/users_guide/source/developerguide.txt
trunk/matplotlib/doc/users_guide/source/documenting_mpl.txt
trunk/matplotlib/doc/users_guide/source/event_handling_tut.txt
trunk/matplotlib/doc/users_guide/source/figures/dollar_ticks.py
trunk/matplotlib/doc/users_guide/source/figures/fig_axes_customize_simple.py
trunk/matplotlib/doc/users_guide/source/figures/fig_axes_labels_simple.py
trunk/matplotlib/doc/users_guide/source/figures/fig_x.py
trunk/matplotlib/doc/users_guide/source/figures/make.py
trunk/matplotlib/doc/users_guide/source/figures/matplotlibrc
trunk/matplotlib/doc/users_guide/source/index.txt
trunk/matplotlib/doc/users_guide/source/introduction.txt
trunk/matplotlib/doc/users_guide/source/userguide.txt
Copied: trunk/matplotlib/doc/users_guide/_static (from rev 5221, trunk/matplotlib/doc/users_guide/source/_static)
Property changes on: trunk/matplotlib/doc/users_guide/_static
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/matplotlib/doc/users_guide/_templates (from rev 5221, trunk/matplotlib/doc/users_guide/source/_templates)
Property changes on: trunk/matplotlib/doc/users_guide/_templates
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/matplotlib/doc/users_guide/add_new_projection.txt (from rev 5220, trunk/matplotlib/doc/users_guide/source/add_new_projection.txt)
===================================================================
--- trunk/matplotlib/doc/users_guide/add_new_projection.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/add_new_projection.txt 2008-05-23 13:49:20 UTC (rev 5222)
@@ -0,0 +1,102 @@
+***********************************************
+Adding new scales and projections to matplotlib
+***********************************************
+
+.. ::author Michael Droettboom
+
+Matplotlib supports the addition of custom procedures that transform
+the data before it is displayed.
+
+There is an important distinction between two kinds of
+transformations. Separable transformations, working on a single
+dimension, are called "scales", and non-separable transformations,
+that handle data in two or more dimensions at a time, are called
+"projections".
+
+From the user's perspective, the scale of a plot can be set with
+``set_xscale()`` and ``set_yscale()``. Projections can be chosen using
+the ``projection`` keyword argument to the ``plot()`` or ``subplot()``
+functions::
+
+ plot(x, y, projection="custom")
+
+This document is intended for developers and advanced users who need
+to create new scales and projections for matplotlib. The necessary
+code for scales and projections can be included anywhere: directly
+within a plot script, in third-party code, or in the matplotlib source
+tree itself.
+
+
+Creating a new scale
+====================
+
+Adding a new scale consists of defining a subclass of ``ScaleBase``
+(in the ``matplotlib.scale`` module), that includes the following
+elements:
+
+ - A transformation from data coordinates into display coordinates.
+
+ - An inverse of that transformation. This is used, for example, to
+ convert mouse positions from screen space back into data space.
+
+ - A function to limit the range of the axis to acceptable values
+ (``limit_range_for_scale()``). A log scale, for instance, would
+ prevent the range from including values less than or equal to
+ zero.
+
+ - Locators (major and minor) that determine where to place ticks in
+ the plot, and optionally, how to adjust the limits of the plot to
+ some "good" values. Unlike ``limit_range_for_scale()``, which is
+ always enforced, the range setting here is only used when
+ automatically setting the range of the plot.
+
+ - Formatters (major and minor) that specify how the tick labels
+ should be drawn.
+
+Once the class is defined, it must be registered with ``matplotlib``
+so that the user can select it.
+
+A full-fledged and heavily annotated example is in
+``examples/custom_scale_example.py``. There are also some ``Scale``
+classes in ``scale.py`` that may be used as starting points.
+
+
+Creating a new projection
+=========================
+
+Adding a new projection consists of defining a subclass of ``Axes``
+(in the ``matplotlib.axes`` module), that includes the following
+elements:
+
+ - A transformation from data coordinates into display coordinates.
+
+ - An inverse of that transformation. This is used, for example, to
+ convert mouse positions from screen space back into data space.
+
+ - Transformations for the gridlines, ticks and ticklabels. Custom
+ projections will often need to place these elements in special
+ locations, and ``matplotlib`` has a facility to help with doing so.
+
+ - Setting up default values (overriding ``cla()``), since the
+ defaults for a rectilinear axes may not be appropriate.
+
+ - Defining the shape of the axes, for example, an elliptical axes,
+ that will be used to draw the background of the plot and for
+ clipping any data elements.
+
+ - Defining custom locators and formatters for the projection. For
+ example, in a geographic projection, it may be more convenient to
+ display the grid in degrees, even if the data is in radians.
+
+ - Set up interactive panning and zooming. This is left as an
+ "advanced" feature left to the reader, but there is an example of
+ this for polar plots in ``polar.py``.
+
+ - Any additional methods for additional convenience or features.
+
+Once the class is defined, it must be registered with ``matplotlib``
+so that the user can select it.
+
+A full-fledged and heavily annotated example is in
+``examples/custom_projection_example.py``. The polar plot
+functionality in ``polar.py`` may also be of interest.
Property changes on: trunk/matplotlib/doc/users_guide/add_new_projection.txt
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ CRLF
Copied: trunk/matplotlib/doc/users_guide/artist_api_tut.txt (from rev 5220, trunk/matplotlib/doc/users_guide/source/artist_api_tut.txt)
===================================================================
--- trunk/matplotlib/doc/users_guide/artist_api_tut.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/artist_api_tut.txt 2008-05-23 13:49:20 UTC (rev 5222)
@@ -0,0 +1,598 @@
+**********************************
+The matplotlib Artist API tutorial
+**********************************
+
+There are three layers to the matplotlib API. The FigureCanvas is the
+area onto which the figure is drawn, the Renderer is the object which
+knows how to draw on the FigureCanvas, and the Artist is the object
+that knows how to use a renderer to paint onto the canvas. The
+FigureCanvas and Renderer handle all the details of talking to user
+interface toolkits like wxpython or drawing languages like postscript,
+and the Artist handles all the high level constructs like
+representing and laying out the figure, text, and lines. The typical
+user will spend 95% of his time working with the Artists.
+
+There are two types Artists: primitives and containers. The
+primitives represent the standard graphical objects we want to paint
+onto our canvas: Line2D, Rectangle, Text, AxesImage, etc, and the
+containers are places to put them (Axis, Axes and Figure). The
+standard use is to create a Figure instance, use the Figure to create
+one or more Axes or Subplot instances, and use the Axes instance
+helper methods to create the primitives. In the example below, we
+create a Figure instance using pyplot.figure, which is a convenience
+method for instantiating Figure instances and connecting them with
+your user interface or drawing toolkit FigureCanvas. As we will
+discuss below, this is not necessary, and you can work directly with
+postscript, pdf gtk, or wxpython FigureCanvas es, instantiate your
+Figures directly and connect them yourselves, but since we are
+focusing here on the Artist API we'll let pyplot handle some of those
+details for us::
+
+ import matplotlib.pyplot as plt
+ fig = plt.figure()
+ ax = fig.add_subplot(2,1,1) # two rows, one column, first plot
+
+The Axes is probably the most important class in the matplotlib API,
+and the one you will be working with most of the time. This is
+because the Axes is the plotting area into which most of the objects
+go, and the Axes has many special helper methods (ax.plot, ax.text,
+ax.hist, ax.imshow) to create the most common graphics primitives
+(Line2D, Text, Rectangle, Image, respectively). These helper methods
+will take your data (eg numpy arrays and strings) create primitive
+Artist instances as needed (eg Line2D), add them to the relevant
+containers, and draw them when requested. Most of you are probably
+familiar with the Subplot, which is just a special case of an Axes
+that lives on a regular rows by columns grid of Subplot instances. If
+you want to create an Axes at an arbitrary location, simply use the
+add_axes method which takes a list of [left, bottom, width, height]
+values in 0-1 relative figure coordinates::
+
+ ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
+
+Continuing with our example::
+
+ import numpy as np
+ 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)
+
+In this example, ax is the Axes instance created by the
+fig.add_subplot call above (remember Subplot is just a subclass of
+Axes) and when you call ax.plot, it creates a Line2D instance and adds
+it the the Axes.lines list. In the interactive ipython session below,
+you can see that Axes.lines list is length one and contains the same
+line that was returned by the "line, ax.plot(x, y, 'o')" call::
+
+ In [101]: ax.lines[0]
+ Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710>
+
+ In [102]: line
+ Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710>
+
+If you make subsequent calls to ax.plot (and the hold state is "on"
+which is the default) then additional lines will be added to the list.
+You can remove lines later simply by calling the list methods; either
+of these will work::
+
+ del ax.lines[0]
+ ax.lines.remove(line) # one or the other, not both!
+
+The Axes also has helper methods to configure and decorate the xaxis
+and yaxis tick, ticklabels and axis labels::
+
+ xtext = ax.set_xlabel('my xdata') # returns a Text instance
+ ytext = ax.set_ylabel('my xdata')
+
+When you call ax.set_xlabel, it passes the information on the Text
+instance of the XAxis. Each Axes instance contains an xaxis and a
+yaxis instance, which handle the layout and drawing of the ticks, tick
+labels and axis labels.
+
+Here are the most important matplotlib modules that contain the
+classes referenced above
+
+=============== ==================
+Artist Module
+=============== ==================
+Artist matplotlib.artist
+Rectangle matplotlib.patches
+Line2D matplotlib.lines
+Axes matplotlib.axes
+XAxis and YAxis matplotlib.axis
+Figure matplotlib.figure
+Text matplotlib.text
+=============== ==================
+
+Try creating the figure below
+
+.. image:: figures/fig_axes_labels_simple.png
+ :scale: 75
+
+Customizing your objects
+========================
+
+Every element in the figure is represented by a matplotlib Artist, and
+each has an extensive list of properties to configure its appearance.
+The figure itself contains a Rectangle exactly the size of the figure,
+which you can use to set the background color and transparency of the
+figures. Likewise, each Axes bounding box (the standard white box
+with black edges in the typical matplotlib plot, has a Rectangle
+instance that determines the color, transparency, and other properties
+of the Axes. These instances are stored as member variables
+Figure.figurePatch and Axes.axesPatch ("Patch" is a name inherited
+from Matlab, and is a 2D "patch" of color on the figure, eg
+rectangles, circles and polygons). Every matplotlib Artist has the
+following properties
+
+========== ======================================================================
+Property Description
+========== ======================================================================
+alpha The transparency - a scalar from 0-1
+animated A boolean that is used to facilitate animated drawing
+axes The axes that the Artist lives in, possibly None
+clip_box The bounding box that clips the Artist
+clip_on Whether clipping is enabled
+clip_path The path the artist is clipped to
+contains A picking function to test whether the artist contains the pick point
+figure The figure instance the aritst lives in, possibly None
+label A text label (eg for auto-labeling)
+picker A python object that controls object picking
+transform The transformation
+visible A boolean whether the artist should be drawn
+zorder A number which determines the drawing order
+========== ======================================================================
+
+Each of the properties is accessed with an old-fashioned setter or
+getter (yes we know this irritates pythonistas and we plan to support
+direct access via properties or traits but it hasn't been done yet).
+For example, to multiply the current alpha by a half::
+
+ a = o.get_alpha()
+ o.set_alpha(0.5*a)
+
+If you want to set a number of properties at once, you can also use
+the "set" method with keyword arguments. For example::
+
+ o.set(alpha=0.5, zorder=2)
+
+If you are working interactively at the python shell, a handy way to
+inspect the artist properties is to use the matplotlib.artist.getp
+method, which lists the properties and their values (simply "getp") in
+pylab. This works for classes derived from Artist as well, eg Figure
+and Rectangle. Here are the Figure rectangle properties mentioned above::
+
+
+ In [149]: matplotlib.artist.getp(fig.figurePatch)
+ alpha = 1.0
+ animated = False
+ antialiased or aa = True
+ axes = None
+ clip_box = None
+ clip_on = False
+ clip_path = None
+ contains = None
+ edgecolor or ec = w
+ facecolor or fc = 0.75
+ figure = Figure(8.125x6.125)
+ fill = 1
+ hatch = None
+ height = 1
+ label =
+ linewidth or lw = 1.0
+ picker = None
+ transform = <Affine object at 0x134cca84>
+ verts = ((0, 0), (0, 1), (1, 1), (1, 0))
+ visible = True
+ width = 1
+ window_extent = <Bbox object at 0x134acbcc>
+ x = 0
+ y = 0
+ zorder = 1
+
+The docstrings for all of the classes also contain the artist
+properties, so you can consult the interactive "help", the online html
+docs at http://matplotlib.sourceforge.net/classdocs.html or PDF documentation
+at http://matplotlib.sourceforge.net/api.pdf for a listing of
+properties for a give object.
+
+Getting at the objects to customize them
+========================================
+
+Now that we know how to inspect set the properties of a given
+object we want to configure, we need to now how to get at that
+object. As mentioned in the introduction, there are two kinds of
+objects: primitives and containers. The primitives are usually the
+things you want to configure (the font of a Text instance, the width
+of a Line2D) although the containers also have some properties as
+well -- for example the Axes Artist is a container that contains many
+of the primitives in your plot, but it also has properties like the
+xscale to control whether the xaxis is 'linear' or 'log'. In this
+section we'll review where the various container objects store the
+Artists that you want to get at.
+
+The Figure container
+--------------------
+
+The top level container Artist is the matplotlib.figure.Figure, and it
+contains everything in the figure. The background of the figure is a
+Rectangle which is stored in fig.figurePatch (where fig is your Figure
+instance). As you add subplots (fig.add_subplot) and axes
+(ax.add_axes)to the figure these will be appended to the fig.axes
+list. These are also returned by the methods that create them::
+
+ In [156]: fig = plt.figure()
+
+ In [157]: ax1 = fig.add_subplot(211)
+
+ In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3])
+
+ In [159]: ax1
+ Out[159]: <matplotlib.axes.Subplot instance at 0xd54b26c>
+
+ In [160]: print fig.axes
+ [<matplotlib.axes.Subplot instance at 0xd54b26c>, <matplotlib.axes.Axes instance at 0xd3f0b2c>]
+
+
+Because the figure maintains the concept of the "current axes" (see
+Figure.gca and Figure.sca) to support the pylab/pyplot state machine,
+you should not insert or remove axes directly from the axes list, but
+rather use the Figure.add_axes and Figure.add_subplot method to
+insert, and the Figure.delaxes methods to delete. You are free
+however, to iterate over the list of axes or index into it to get
+access to Axes instances you want to customize. Here is an example
+which turns all the axes grids on::
+
+ for ax in fig.axes:
+ ax.grid(True)
+
+
+The figure also has its own text, lines, patches and images, which you
+can use to add primitives directly. The default coordinate system for
+the Figure will simply be in pixels (which is not usually what you
+want) but you can control this by setting the transform property of
+the Artist you are adding to the figure. More useful is "figure
+coordinates" where 0,0 is the bottom, left of the figure and 1,1 is
+the top, right of the figure which you can obtain by setting the
+Artist transform to fig.transFigure::
+
+ In [191]: fig = plt.figure()
+
+ In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
+
+ In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
+
+ In [194]: fig.lines.extend([l1, l2])
+
+ In [195]: fig.canvas.draw()
+
+.. image:: figures/fig_x.png
+ :scale: 75
+
+
+Here is a summary of the Artists the figure contains
+
+================ ===============================================================
+Figure attribute Description
+================ ===============================================================
+axes A list of Axes instances (includes Subplot)
+figurePatch The Rectangle background
+images A list of FigureImages patches - useful for raw pixel display
+legends A list of Figure Legend instances (different from Axes.legends)
+lines A list of Figure Line2D instances (rarely used, see Axes.lines)
+patches A list of Figure patches (rarely used, see Axes.patches)
+texts A list Figure Text instances
+================ ===============================================================
+
+
+The Axes container
+------------------
+
+The matplotlib.axes.Axes is the center of the matplotlib universe --
+it contains the vast majority of all the Artists used in a figure with
+many helper methods to create and these Artists to itself, as well as
+helper methods to access and customize the Artists it contains. Like
+the Figure, it contains a Patch ax.axesPatch which is Rectangle for
+Cartesian coordinates and a Circle for polar coordinates; this patch
+determines the shape, background and border of the plotting region::
+
+ ax = fig.add_subplot(111)
+ rect = ax.axesPatch # a Rectangle instance
+ rect.set_facecolor('green')
+
+When you call a plotting method, eg the canonical "ax.plot" and pass
+in arrays or list of values, the method will a matplotlib.lines.Line2D
+instance, update the line with all the Line2D properties passed as
+keyword arguments, add the line to the Axes.lines container, and
+returns it to you::
+
+ In [213]: x, y = np.random.rand(2, 100)
+
+ In [214]: line, = ax.plot(x, y, '-', color='blue', linewidth=2)
+
+ax.plot returns a list of lines because you can pass in multiple x, y
+pairs to plot, and we are unpacking the first element of the length
+one list into the line variable. The line has been added to the
+ax.lines list::
+
+
+ In [229]: print ax.lines
+ [<matplotlib.lines.Line2D instance at 0xd378b0c>]
+
+Similarly, methods that create patches, like ax.bar creates a list of
+rectangles, will add the patches to the ax.patches list::
+
+ In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow')
+
+ In [234]: rectangles
+ Out[234]: <a list of 50 Patch objects>
+
+ In [235]: print len(ax.patches)
+
+You should not add objects directly to the ax.lines or ax.patches
+unless you know exactly what you are doing, because the Axes needs to
+do a few things when it creates and adds an object. It sets the figure
+and axes property of the Artist, as well as the default Axes
+transformation (unless a transformation is set). It also inspects the
+data contained in the Artist to update the data structures controlling
+auto-scaling, so that the view limits can be adjusted to contain the
+plotted data. You can, nonetheless, create objects yourself and add
+them directly to the Axes using helper methods like ax.add_line and
+ax.add_patch. Here is an annotated interactive session illustrating
+what is going on::
+
+ In [261]: fig = plt.figure()
+
+ In [262]: ax = fig.add_subplot(111)
+
+ # create a rectangle instance
+ In [263]: rect = matplotlib.patches.Rectangle( (1,1), width=5, height=12)
+
+ # by default the axes instance is None
+ In [264]: print rect.get_axes()
+ None
+
+ # and the transformation instance is set to the "identity transform"
+ In [265]: print rect.get_transform()
+ <Affine object at 0x13695544>
+
+ # now we add the Rectangle to the Axes
+ In [266]: ax.add_patch(rect)
+
+ # and notice that the ax.add_patch method has set the axes
+ # instance
+ In [267]: print rect.get_axes()
+ Subplot(49,81.25)
+
+ # and the transformation has been set too
+ In [268]: print rect.get_transform()
+ <Affine object at 0x15009ca4>
+
+ # the default axes transformation is ax.transData
+ In [269]: print ax.transData
+ <Affine object at 0x15009ca4>
+
+ # notice that the xlimits of the Axes have not been changed
+ In [270]: print ax.get_xlim()
+ (0.0, 1.0)
+
+ # but the data limits have been updated to encompass the rectangle
+ In [271]: print ax.dataLim.get_bounds()
+ (1.0, 1.0, 5.0, 12.0)
+
+ # we can manually invoke the auto-scaling machinery
+ In [272]: ax.autoscale_view()
+
+ # and now the xlim are updated to encompass the rectangle
+ In [273]: print ax.get_xlim()
+ (1.0, 6.0)
+
+ # we have to manually force a figure draw
+ In [274]: ax.figure.canvas.draw()
+
+
+There are many, many Axes helper methods for creating primitive
+Artists and adding them to their respective containers. The table
+below summarizes a small sampling of them, the kinds of Artist they
+create, and where they store them
+
+============================== ==================== =======================
+Helper method Artist Container
+============================== ==================== =======================
+ax.annotate - text annotations Annotate ax.texts
+ax.bar - bar charts Rectangle ax.patches
+ax.errorbar - error bar plots Line2D and Rectangle ax.lines and ax.patches
+ax.fill - shared area Polygon ax.patches
+ax.hist - histograms Rectangle ax.patches
+ax.imshow - image data AxesImage ax.images
+ax.legend - axes legends Legend ax.legends
+ax.plot - xy plots Line2D ax.lines
+ax.scatter - scatter charts PolygonCollection ax.collections
+ax.text - text Text ax.texts
+============================== ==================== =======================
+
+
+In addition to all of these Artists, the Axes contains two important
+Artist containers: the XAxis and YAxis, which handle the drawing of
+the ticks and labels. These are stored as instance variables xaxis
+and yaxis. The XAxis and YAxis containers will be detailed below, but
+note that the Axes contains many helper methods which forward calls on
+to the Axis instances so you often do not need to work with them
+directly unless you want to. For example, you can set the fontsize of
+the XAxis ticklabels using the Axes helper method::
+
+ for label in ax.get_xticklabels():
+ label.set_color('orange')
+
+Below is a summary of the Artists that the Axes contains
+
+============== ======================================
+Axes attribute Description
+============== ======================================
+artists A list of Artist instances
+axesPatch Rectangle instance for Axes background
+collections A list of Collection instances
+images A list of AxesImage
+legends A list of Legend instances
+lines A list of Line2D instances
+patches A list of Patch instances
+texts A list of Text instances
+xaxis matplotlib.axis.XAxis instance
+yaxis matplotlib.axis.YAxis instance
+============== ======================================
+
+The Axis containers
+-------------------
+
+The matplotlib.axis.Axis instances handle the drawing of the tick lines, the grid
+lines, the tick labels and the axis label. You can configure the left
+and right ticks separately for the y axis, and the upper and lower
+ticks separately for the x axis. The axis also stores the data and view
+intervals used in auto-scaling, panning and zooming, as well as the
+locator and formatter instances which control where the ticks are
+placed and how they are represented as strings.
+
+Each axis object contains a label attribute (this is what the pylab
+calls to xlabel and ylabel set) as well as a list of major and minor
+ticks. The ticks are XTick and YTick instances, which contain the
+actual line and text primitives that render the ticks and ticklabels.
+Because the ticks are dynamically created as needed (eg when panning
+and zooming), you should access the lists of major and minor ticks
+through their accessor methods axis.get_major_ticks() and
+axis.get_minor_ticks(). Although the ticks contain all the primitives
+and will be covered below, the Axis methods contain accessor methods
+to return the tick lines, tick labels, tick locations etc....::
+
+ In [285]: axis = ax.xaxis
+
+ In [286]: axis.get_ticklocs()
+ Out[286]: array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
+
+ In [287]: axis.get_ticklabels()
+ Out[287]: <a list of 10 Text major ticklabel objects>
+
+ # note there are twice as many ticklines as labels because by
+ # default there are tick lines at the top and bottom but only tick
+ # labels below the xaxis; this can be customized
+ In [288]: axis.get_ticklines()
+ Out[288]: <a list of 20 Line2D ticklines objects>
+
+ # by default you get the major ticks back
+ In [291]: axis.get_ticklines()
+ Out[291]: <a list of 20 Line2D ticklines objects>
+
+ # but you can also ask for the minor ticks
+ In [292]: axis.get_ticklines(minor=True)
+ Out[292]: <a list of 0 Line2D ticklines objects>
+
+Here is a summary of some of the useful accessor methods of the Axis
+(these have corresponding setters where useful, such as
+set_major_formatter)
+
+====================== =========================================================
+Accessor method Description
+====================== =========================================================
+get_scale The scale of the axis, eg 'log' or 'linear'
+get_view_interval The interval instance of the axis view limits
+get_data_interval The interval instance of the axis data limits
+get_gridlines A list of grid lines for the Axis
+get_label The axis label - a Text instance
+get_ticklabels A list of Text instances - keyword minor=True|False
+get_ticklines A list of Line2D instances - keyword minor=True|False
+get_ticklocs A list of Tick locations - keyword minor=True|False
+get_major_locator The matplotlib.ticker.Locator instance for major ticks
+get_major_formatter The matplotlib.ticker.Formatter instance for major ticks
+get_minor_locator The matplotlib.ticker.Locator instance for minor ticks
+get_minor_formatter The matplotlib.ticker.Formatter instance for minor ticks
+get_major_ticks A list of Tick instances for major ticks
+get_minor_ticks A list of Tick instances for minor ticks
+grid Turn the grid on or off for the major or minor ticks
+====================== =========================================================
+
+Try creating the figure below
+
+.. image:: figures/fig_axes_customize_simple.png
+ :scale: 75
+
+Exercise solution::
+
+ 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)
+
+ fig.savefig('figures/fig_axes_customize_simple.png', dpi=150)
+ fig.savefig('figures/fig_axes_customize_simple.eps')
+ plt.show()
+
+
+
+The Tick containers
+-------------------
+
+The matplotlib.axis.Tick is the final container object in our descent
+from the Figure to the Axes to the Axis to the Tick. The Tick
+contains the tick and grid line instances, as well as the label
+instances for the upper and lower ticks. Each of these is accessible
+directly as an attribute of the Tick. In addition, there are boolean
+variables that determine whether the upper labels and ticks are on for
+the xaxis and whether the right labels and ticks are on for the yaxis.
+
+============== ==========================================================
+Tick attribute Description
+============== ==========================================================
+tick1line Line2D instance
+tick2line Line2D instance
+gridline Line2D instance
+label1 Text instance
+label2 Text instance
+gridOn boolean which determines whether to draw the tickline
+tick1On boolean which determines whether to draw the 1st tickline
+tick2On boolean which determines whether to draw the 2nd tickline
+label1On boolean which determines whether to draw tick label
+label2On boolean which determines whether to draw tick label
+============== ==========================================================
+
+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::
+
+ 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')
+
+ plt.show()
+
+
+.. image:: figures/dollar_ticks.png
+ :scale: 75
Property changes on: trunk/matplotlib/doc/users_guide/artist_api_tut.txt
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ CRLF
Copied: trunk/matplotlib/doc/users_guide/coding_guide.txt (from rev 5220, trunk/matplotlib/doc/users_guide/source/coding_guide.txt)
===================================================================
--- trunk/matplotlib/doc/users_guide/coding_guide.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/coding_guide.txt 2008-05-23 13:49:20 UTC (rev 5222)
@@ -0,0 +1,3 @@
+
+.. include:: ../../CODING_GUIDE
+
Property changes on: trunk/matplotlib/doc/users_guide/coding_guide.txt
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ CRLF
Copied: trunk/matplotlib/doc/users_guide/conf.py (from rev 5220, trunk/matplotlib/doc/users_guide/source/conf.py)
===================================================================
--- trunk/matplotlib/doc/users_guide/conf.py (rev 0)
+++ trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 13:49:20 UTC (rev 5222)
@@ -0,0 +1,155 @@
+# -*- coding: utf-8 -*-
+#
+# Matplotlib documentation build configuration file, created by
+# sphinx-quickstart on Fri May 2 12:33:25 2008.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default value; values that are commented out
+# serve to show the default value.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+sys.path.append(os.path.abspath('../sphinxext'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['mathml', 'sphinx.ext.autodoc']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.txt'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General substitutions.
+project = 'Matplotlib'
+copyright = '2008, John Hunter, Darren Dale'
+
+# The default replacements for |version| and |release|, also used in various
+# other places throughout the built documents.
+#
+# The short X.Y version.
+version = '0.98'
+# The full version, including alpha/beta/rc tags.
+release = '0.98pre'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# The name of an image file (within the static path) to place at the top of
+# the sidebar.
+#html_logo = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If nonempty, this is the file name suffix for generated HTML files. The
+# default is ``".html"``.
+html_file_suffix = '.xml'
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.
+html_use_opensearch = 'False'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'Matplotlibdoc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+latex_font_size = '11pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+ ('index', 'Matplotlib_Users_Guide.tex', 'Matplotlib Users Guide', 'John Hunter, Darren Dale', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+latex_logo = None
+
+# Additional stuff for the LaTeX preamble.
+latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+latex_appendices = []
+
+# If false, no module index is generated.
+latex_use_modindex = True
+
+latex_use_parts = True
Property changes on: trunk/matplotlib/doc/users_guide/conf.py
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: trunk/matplotlib/doc/users_guide/developerguide.txt (from rev 5220, trunk/matplotlib/doc/users_guide/source/developerguide.txt)
===================================================================
--- trunk/matplotlib/doc/users_guide/developerguide.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/developerguide.txt 2008-05-23 13:49:20 UTC (rev 5222)
@@ -0,0 +1,12 @@
+############################
+Matplotlib Developers Guide
+############################
+
+.. _contents:
+
+.. toctree::
+ :maxdepth: 3
+
+ coding_guide
+ documenting_mpl
+ add_new_projection
Property changes on: trunk/matplotlib/doc/users_guide/developerguide.txt
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ CRLF
Copied: trunk/matplotlib/doc/users_guide/documenting_mpl.txt (from rev 5220, trunk/matplotlib/doc/users_guide/source/documenting_mpl.txt)
===================================================================
--- trunk/matplotlib/doc/users_guide/documenting_mpl.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/documenting_mpl.txt 2008-05-23 13:49:20 UTC (rev 5222)
@@ -0,0 +1,43 @@
+**********************
+Documenting Matplotlib
+**********************
+
+The documentation for matplotlib is generated from ReStructured Text
+using the Sphinx_ documentation generation tool. Sphinx-0.4 or later
+is required to generate xml files to render mathematical expressions
+with mathml. Currently this means we need to install from the svn
+repository by doing::
+
+ svn co http://svn.python.org/projects/doctools/trunk sphinx
+ cd sphinx
+ python setup.py install
+
+.. _Sphinx: http://sphinx.pocoo.org/
+
+The documentation sources are found in the doc/ directory in the trunk.
+To build the users guid in html format, cd into doc/users_guide and do::
+
+ python make.py html
+
+you can also pass a ``latex`` flag to make.py to build a pdf, or pass no
+arguments to build everything. The same procedure can be followed for
+the sources in doc/api_reference.
+
+The actual ReStructured Text files are kept in doc/users_guide/source
+and doc/api_reference/source. The main entry point is index.txt.
+Additional files can be added by including their base file name
+(dropping the .txt extension) in the table of contents. It is also
+possible to include other documents through the use of an include
+statement. For example, in the Developers Guide, index.txt lists
+coding_guide, which automatically inserts coding_guide.txt.
+coding_guide.txt is just a placeholder, it contains one line only to
+gets its contents from the CODING_GUIDE file in the trunk:
+``.. include:: ../../CODING_GUIDE``.
+
+The output produced by Sphinx can be configured by editing the conf.py
+files located in the documentation source directories.
+
+The Sphinx website contains plenty of documentation_ concerning ReST
+markup and working with Sphinx in general.
+
+.. _documentation: http://sphinx.pocoo.org/contents.html
\ No newline at end of file
Property changes on: trunk/matplotlib/doc/users_guide/documenting_mpl.txt
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/matplotlib/doc/users_guide/event_handling_tut.txt (from rev 5220, trunk/matplotlib/doc/users_guide/source/event_handling_tut.txt)
===================================================================
--- trunk/matplotlib/doc/users_guide/event_handling_tut.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/event_handling_tut.txt 2008-05-23 13:49:20 UTC (rev 5222)
@@ -0,0 +1,471 @@
+***********************************
+Event Handling and Picking Tutorial
+***********************************
+
+matplotlib works with 5 user interface toolkits (wxpython, tkinter,
+qt, gtk and fltk) and in order to support features like interactive
+panning and zooming of figures, it is helpful to the developers to
+have an API for interacting with the figure via key presses and mouse
+movements that is "GUI neutral" so we don't have to repeat a lot of
+code across the different user interfaces. Although the event
+handling API is GUI neutral, it is based on the GTK model, which was
+the first user interface matplotlib supported. The events that are
+triggered are also a bit richer vis-a-vis matplotlib than standard GUI
+events, including information like which Axes the event occurred in.
+The events also understand the matplotlib coordinate system, and
+report event locations in both pixel and data coordinates.
+
+
+Event connections
+=================
+
+To receive events, you need to write a callback function and then
+connect your function to the event manager, which is part of the
+FigureCanvas. Here is a simple example that prints the location of
+the mouse click and which button was pressed::
+
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ ax.plot(np.random.rand(10))
+
+ def onclick(event):
+ print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(
+ event.button, event.x, event.y, event.xdata, event.ydata)
+
+ cid = fig.canvas.mpl_connect('button_press_event', onclick)
+
+The FigureCanvas method mpl_connect returns a connection id which is
+simply an integer. When you want to disconnect the callback, just
+call::
+
+ fig.canvas.mpl_disconnect(cid)
+
+Here are the events that you can connect to, the class instances that
+are sent back to you when the event occurs, and the event descriptions
+
+
+===================== =========== ===================================
+Event name Class Description
+===================== =========== ===================================
+button_press_event MouseEvent mouse button is pressed
+button_release_event MouseEvent mouse button is released
+draw_event DrawEvent canvas draw
+key_press_event KeyEvent key is pressed
+key_release_event KeyEvent key is released
+motion_notify_event MouseEvent mouse motion
+pick_event PickEvent an object in the canvas is selected
+resize_event ResizeEvent figure canvas is resized
+scroll_event MouseEvent mouse scroll wheel is rolled
+===================== =========== ===================================
+
+
+Event attributes
+================
+
+All matplotlib events inherit from the base class
+matplotlib.backend_bases.Event, which store the attributes
+
+=============== =================================================
+Event attribute Description
+=============== =================================================
+name the event name
+canvas the FigureCanvas instance generating the event
+guiEvent the GUI event that triggered the matplotlib event
+=============== =================================================
+
+The most common events that are the bread and butter of event handling
+are key press/release events and mouse press/release and movement
+events. The KeyEvent and MouseEvent classes that handle these events
+are both derived from the LocationEvent, which has the following
+attributes
+
+======================= ========================================
+LocationEvent attribute Description
+======================= ========================================
+x x position - pixels from left of canvas
+y y position - pixels from right of canvas
+button button pressed None, 1, 2, 3
+inaxes the Axes instance if mouse us over axes
+xdata x coord of mouse in data coords
+ydata y coord of mouse in data coords
+======================= ========================================
+
+Let's look a simple example of a canvas, where a simple line segment
+is created every time a mouse is pressed::
+
+ class LineBuilder:
+ def __init__(self, line):
+ self.line = line
+ self.xs = list(line.get_xdata())
+ self.ys = list(line.get_ydata())
+ self.cid = line.figure.canvas.mpl_connect('button_press_event', self)
+
+ def __call__(self, event):
+ print 'click', event
+ if event.inaxes!=self.line.axes: return
+ self.xs.append(event.xdata)
+ self.ys.append(event.ydata)
+ self.line.set_data(self.xs, self.ys)
+ self.line.figure.canvas.draw()
+
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ ax.set_title('click to build line segments')
+ line, = ax.plot([0], [0]) # empty line
+ linebuilder = LineBuilder(line)
+
+
+
+The MouseEvent that we just used is a LocationEvent, so we have access
+to the data and pixel coordinates in event.x and event.xdata. In
+addition to the LocationEvent attributes, it has
+
+==================== ==============================================================
+MouseEvent attribute Description
+==================== ==============================================================
+button button pressed None, 1, 2, 3
+key the key pressed: None, chr(range(255)), shift, win, or control
+==================== ==============================================================
+
+Draggable Rectangle Exercise
+----------------------------
+
+Write draggable rectangle class that is initialized with a Rectangle
+instance but will move its x,y location when dragged. Hint: you will
+need to store the orginal xy location of the rectangle which is stored
+as rect.xy and connect to the press, motion and release mouse events.
+When the mouse is pressed, check to see if the click occurs over your
+rectangle (see rect.contains) and if it does, store the rectangle xy
+and the location of the mouse click in data coords. In the motion
+event callback, compute the deltax and deltay of the mouse movement,
+and add those deltas to the origin of the rectangle you stored. The
+redraw the figure. On the button release event, just reset all the
+button press data you stored as None.
+
+Here is the solution::
+
+ import numpy as np
+ import matplotlib.pyplot as plt
+
+ class DraggableRectangle:
+ def __init__(self, rect):
+ self.rect = rect
+ self.press = None
+
+ def connect(self):
+ 'connect to all the events we need'
+ self.cidpress = self.rect.figure.canvas.mpl_connect(
+ 'button_press_event', self.on_press)
+ self.cidrelease = self.rect.figure.canvas.mpl_connect(
+ 'button_release_event', self.on_release)
+ self.cidmotion = self.rect.figure.canvas.mpl_connect(
+ 'motion_notify_event', self.on_motion)
+
+ def on_press(self, event):
+ 'on button press we will see if the mouse is over us and store some data'
+ if event.inaxes != self.rect.axes: return
+
+ contains, attrd = self.rect.contains(event)
+ if not contains: return
+ print 'event contains', self.rect.xy
+ x0, y0 = self.rect.xy
+ self.press = x0, y0, event.xdata, event.ydata
+
+ def on_motion(self, event):
+ 'on motion we will move the rect if the mouse is over us'
+ if self.press is None: return
+ if event.inaxes != self.rect.axes: return
+ x0, y0, xpress, ypress = self.press
+ dx = event.xdata - xpress
+ dy = event.ydata - ypress
+ #print 'x0=%f, xpress=%f, event.xdata=%f, dx=%f, x0+dx=%f'%(x0, xpress, event.xdata, dx, x0+dx)
+ self.rect.set_x(x0+dx)
+ self.rect.set_y(y0+dy)
+
+ self.rect.figure.canvas.draw()
+
+
+ def on_release(self, event):
+ 'on release we reset the press data'
+ self.press = None
+ self.rect.figure.canvas.draw()
+
+ def disconnect(self):
+ 'disconnect all the stored connection ids'
+ self.rect.figure.canvas.mpl_disconnect(self.cidpress)
+ self.rect.figure.canvas.mpl_disconnect(self.cidrelease)
+ self.rect.figure.canvas.mpl_disconnect(self.cidmotion)
+
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ rects = ax.bar(range(10), 20*np.random.rand(10))
+ drs = []
+ for rect in rects:
+ dr = DraggableRectangle(rect)
+ dr.connect()
+ drs.append(dr)
+
+ plt.show()
+
+
+**Extra credit**: use the animation blit techniques discussed at
+http://www.scipy.org/Cookbook/Matplotlib/Animations to make the
+animated drawing faster and smoother.
+
+Extra credit solution::
+
+ # draggable rectangle with the animation blit techniques; see
+ # http://www.scipy.org/Cookbook/Matplotlib/Animations
+ import numpy as np
+ import matplotlib.pyplot as plt
+
+ class DraggableRectangle:
+ lock = None # only one can be animated at a time
+ def __init__(self, rect):
+ self.rect = rect
+ self.press = None
+ self.background = None
+
+ def connect(self):
+ 'connect to all the events we need'
+ self.cidpress = self.rect.figure.canvas.mpl_connect(
+ 'button_press_event', self.on_press)
+ self.cidrelease = self.rect.figure.canvas.mpl_connect(
+ 'button_release_event', self.on_release)
+ self.cidmotion = self.rect.figure.canvas.mpl_connect(
+ 'motion_notify_event', self.on_motion)
+
+ def on_press(self, event):
+ 'on button press we will see if the mouse is over us and store some data'
+ if event.inaxes != self.rect.axes: return
+ if DraggableRectangle.lock is not None: return
+ contains, attrd = self.rect.contains(event)
+ if not contains: return
+ print 'event contains', self.rect.xy
+ x0, y0 = self.rect.xy
+ self.press = x0, y0, event.xdata, event.ydata
+ DraggableRectangle.lock = self
+
+ # draw everything but the selected rectangle and store the pixel buffer
+ canvas = self.rect.figure.canvas
+ axes = self.rect.axes
+ self.rect.set_animated(True)
+ canvas.draw()
+ self.background = canvas.copy_from_bbox(self.rect.axes.bbox)
+
+ # now redraw just the rectangle
+ axes.draw_artist(self.rect)
+
+ # and blit just the redrawn area
+ canvas.blit(axes.bbox)
+
+ def on_motion(self, event):
+ 'on motion we will move the rect if the mouse is over us'
+ if DraggableRectangle.lock is not self:
+ return
+ if event.inaxes != self.rect.axes: return
+ x0, y0, xpress, ypress = self.press
+ dx = event.xdata - xpress
+ dy = event.ydata - ypress
+ self.rect.set_x(x0+dx)
+ self.rect.set_y(y0+dy)
+
+
+ canvas = self.rect.figure.canvas
+ axes = self.rect.axes
+ # restore the background region
+ canvas.restore_region(self.background)
+
+ # redraw just the current rectangle
+ axes.draw_artist(self.rect)
+
+ # blit just the redrawn area
+ canvas.blit(axes.bbox)
+
+
+
+ def on_release(self, event):
+ 'on release we reset the press data'
+ if DraggableRectangle.lock is not self:
+ return
+
+ self.press = None
+ DraggableRectangle.lock = None
+
+ # turn off the rect animation property and reset the background
+ self.rect.set_animated(False)
+ self.background = None
+
+ # redraw the full figure
+ self.rect.figure.canvas.draw()
+ def disconnect(self):
+ 'disconnect all the stored connection ids'
+ self.rect.figure.canvas.mpl_disconnect(self.cidpress)
+ self.rect.figure.canvas.mpl_disconnect(self.cidrelease)
+ self.rect.figure.canvas.mpl_disconnect(self.cidmotion)
+
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ rects = ax.bar(range(10), 20*np.random.rand(10))
+ drs = []
+ for rect in rects:
+ dr = DraggableRectangle(rect)
+ dr.connect()
+ drs.append(dr)
+
+ plt.show()
+
+
+Object Picking
+==============
+
+You can enable picking by setting the ``picker`` property of an Artist
+(eg a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
+etc...)
+
+There are a variety of meanings of the picker property:
+
+- None : picking is disabled for this artist (default)
+
+- boolean : if True then picking will be enabled and the artist will
+ fire a pick event if the mouse event is over the artist
+
+- float : if picker is a number it is interpreted as an epsilon
+ tolerance in points and the the artist will fire off an event if its
+ data is within epsilon of the mouse event. For some artists like
+ lines and patch collections, the artist may provide additional data
+ to the pick event that is generated, eg the indices of the data
+ within epsilon of the pick event.
+
+- function : if picker is callable, it is a user supplied function
+ which determines whether the artist is hit by the mouse event. The
+ signature is ``hit, props = picker(artist, mouseevent)`` to
+ determine the hit test. If the mouse event is over the artist,
+ return hit=True and props is a dictionary of properties you want
+ added to the PickEvent attributes
+
+
+After you have enabled an artist for picking by setting the ``picker``
+property, you need to connect to the figure canvas pick_event to get
+pick callbacks on mouse press events. Eg::
+
+ def pick_handler(event):
+ mouseevent = event.mouseevent
+ artist = event.artist
+ # now do something with this...
+
+
+The pick event (matplotlib.backend_bases.PickEvent) which is passed to
+your callback is always fired with two attributes:
+
+- mouseevent : the mouse event that generate the pick event. The
+ mouse event in turn has attributes like x and y (the coords in
+ display space, eg pixels from left, bottom) and xdata, ydata (the
+ coords in data space). Additionally, you can get information about
+ which buttons were pressed, which keys were pressed, which Axes the
+ mouse is over, etc. See matplotlib.backend_bases.MouseEvent for
+ details.
+
+- artist : the matplotlib.artist that generated the pick event.
+
+Additionally, certain artists like Line2D and PatchCollection may
+attach additional meta data like the indices into the data that meet
+the picker criteria (eg all the points in the line that are within the
+specified epsilon tolerance)
+
+Simple picking example
+----------------------
+
+In the example below, we set the line picker property to a scalar, so
+it represents a tolerance in points (72 points per inch). The onpick
+callback function will be called when the pick event it within the
+tolerance distance from the line, and has the indices of the data
+vertices that are within the pick distance tolerance. Our onpick
+callback function simply prints the data that are under the pick
+location. Different matplotlib Artists can attach different data to
+the PickEvent. For example, Line2D attaches the ind property, which
+are the indices into the line data under the pick point. See
+Line2D.pick for details on the PickEvent properties of the line. Here
+is the code::
+
+ import numpy as np
+ import matplotlib.pyplot as plt
+
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ ax.set_title('click on points')
+
+ line, = ax.plot(np.random.rand(100), 'o', picker=5) # 5 points tolerance
+
+ def onpick(event):
+ thisline = event.artist
+ xdata = thisline.get_xdata()
+ ydata = thisline.get_ydata()
+ ind = event.ind
+ print 'onpick points:', zip(xdata[ind], ydata[ind])
+
+ fig.canvas.mpl_connect('pick_event', onpick)
+
+ plt.show()
+
+
+Picking Exercise
+----------------
+
+Create a data set of 100 arrays of 1000 Gaussian random numbers and
+compute the sample mean and standard deviation of each of them (hint:
+numpy arrays have a mean and std method) and make a xy marker plot of
+the 100 means vs the 100 standard deviations. Connect the line
+created by the plot command to the pick event, and plot the original
+time series of the data that generated the clicked on points. If more
+than one point is within the tolerance of the clicked on point, you
+can use multiple subplots to plot the multiple time series.
+
+Exercise solution::
+
+ """
+ compute the mean and stddev of 100 data sets and plot mean vs stddev.
+ When you click on one of the mu, sigma points, plot the raw data from
+ the dataset that generated the mean and stddev
+ """
+ import numpy as np
+ import ma...
[truncated message content] |
|
From: <mme...@us...> - 2008-05-23 07:51:24
|
Revision: 5221
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5221&view=rev
Author: mmetz_bn
Date: 2008-05-23 00:51:20 -0700 (Fri, 23 May 2008)
Log Message:
-----------
Major hist() revision
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab/histogram_demo.py
trunk/matplotlib/lib/matplotlib/axes.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab/histogram_demo_extended.py
Removed Paths:
-------------
trunk/matplotlib/examples/pylab/histogram_demo_cumulative.py
trunk/matplotlib/examples/pylab/histogram_demo_step.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-22 21:49:25 UTC (rev 5220)
+++ trunk/matplotlib/CHANGELOG 2008-05-23 07:51:20 UTC (rev 5221)
@@ -1,3 +1,8 @@
+2008-05-23 Major revision of hist(). Can handle 2D arrays and create
+ stacked histogram plots; keyword 'width' deprecated and
+ rwidth (relative width) introduced; align='edge' changed
+ to center of bin - MM
+
2008-05-22 Added support for ReST-based doumentation using Sphinx.
Documents are located in doc/, and are broken up into
a users guide and an API reference. To build, run the
Modified: trunk/matplotlib/examples/pylab/histogram_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab/histogram_demo.py 2008-05-22 21:49:25 UTC (rev 5220)
+++ trunk/matplotlib/examples/pylab/histogram_demo.py 2008-05-23 07:51:20 UTC (rev 5221)
@@ -1,23 +1,23 @@
#!/usr/bin/env python
-from pylab import *
+import pylab as P
mu, sigma = 100, 15
-x = mu + sigma*randn(10000)
+x = mu + sigma*P.randn(10000)
# the histogram of the data
-n, bins, patches = hist(x, 50, normed=1)
-setp(patches, 'facecolor', 'g', 'alpha', 0.75)
+n, bins, patches = P.hist(x, 50, normed=1)
+P.setp(patches, 'facecolor', 'g', 'alpha', 0.75)
# add a 'best fit' line
-y = normpdf( bins, mu, sigma)
-l = plot(bins, y, 'r--')
-setp(l, 'linewidth', 1)
+y = P.normpdf( bins, mu, sigma)
+l = P.plot(bins, y, 'r--')
+P.setp(l, 'linewidth', 1)
-xlabel('Smarts')
-ylabel('Probability')
-title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
-axis([40, 160, 0, 0.03])
-grid(True)
+P.xlabel('Smarts')
+P.ylabel('Probability')
+P.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
+P.axis([40, 160, 0, 0.03])
+P.grid(True)
-#savefig('histogram_demo',dpi=72)
-show()
+#P.savefig('histogram_demo',dpi=72)
+P.show()
Deleted: trunk/matplotlib/examples/pylab/histogram_demo_cumulative.py
===================================================================
--- trunk/matplotlib/examples/pylab/histogram_demo_cumulative.py 2008-05-22 21:49:25 UTC (rev 5220)
+++ trunk/matplotlib/examples/pylab/histogram_demo_cumulative.py 2008-05-23 07:51:20 UTC (rev 5221)
@@ -1,33 +0,0 @@
-#!/usr/bin/env python
-from pylab import *
-
-mu, sigma = 100, 25
-x = mu + sigma*randn(10000)
-
-# the histogram of the data
-n, bins, patches = hist(x, 50, normed=1, histtype='step', cumulative=True)
-setp(patches, 'facecolor', 'g', 'alpha', 0.75)
-
-# add a 'best fit' line
-y = normpdf( bins, mu, sigma).cumsum()
-y /= y[-1]
-l = plot(bins, y, 'k--', linewidth=1.5)
-
-# overlay the first histogram with a second one
-# were the data has a smaller standard deviation
-mu, sigma = 100, 10
-x = mu + sigma*randn(10000)
-
-n, bins, patches = hist(x, bins=bins, normed=1, histtype='step', cumulative=True)
-setp(patches, 'facecolor', 'r', 'alpha', 0.25)
-
-# add a 'best fit' line
-y = normpdf( bins, mu, sigma).cumsum()
-y /= y[-1]
-l = plot(bins, y, 'k--', linewidth=1.5)
-
-grid(True)
-ylim(0, 1.1)
-
-#savefig('histogram_demo',dpi=72)
-show()
\ No newline at end of file
Added: trunk/matplotlib/examples/pylab/histogram_demo_extended.py
===================================================================
--- trunk/matplotlib/examples/pylab/histogram_demo_extended.py (rev 0)
+++ trunk/matplotlib/examples/pylab/histogram_demo_extended.py 2008-05-23 07:51:20 UTC (rev 5221)
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+import pylab as P
+
+#
+# The hist() function now has a lot more options
+#
+
+#
+# first create a single histogram
+#
+mu, sigma = 200, 25
+x = mu + sigma*P.randn(10000)
+
+# the histogram of the data with histtype='step'
+n, bins, patches = P.hist(x, 50, normed=1, histtype='step')
+P.setp(patches, 'facecolor', 'g', 'alpha', 0.75)
+
+# add a line showing the expected distribution
+y = P.normpdf( bins, mu, sigma)
+l = P.plot(bins, y, 'k--', linewidth=1.5)
+
+
+#
+# create a histogram by providing the bin edges (unequally spaced)
+#
+P.figure()
+
+bins = [100,125,150,160,170,180,190,200,210,220,230,240,250,275,300]
+# the histogram of the data with histtype='step'
+n, bins, patches = P.hist(x, bins, normed=1, histtype='bar', rwidth=0.8)
+
+#
+# now we create a cumulative histogram of the data
+#
+P.figure()
+
+n, bins, patches = P.hist(x, 50, normed=1, histtype='step', cumulative=True)
+P.setp(patches, 'facecolor', 'b', 'alpha', 0.75)
+
+# add a line showing the expected distribution
+y = P.normpdf( bins, mu, sigma).cumsum()
+y /= y[-1]
+l = P.plot(bins, y, 'k--', linewidth=1.5)
+
+# create a second data-set with a smaller standard deviation
+sigma2 = 15.
+x = mu + sigma2*P.randn(10000)
+
+n, bins, patches = P.hist(x, bins=bins, normed=1, histtype='step', cumulative=True)
+P.setp(patches, 'facecolor', 'r', 'alpha', 0.5)
+
+# add a line showing the expected distribution
+y = P.normpdf( bins, mu, sigma2).cumsum()
+y /= y[-1]
+l = P.plot(bins, y, 'r--', linewidth=1.5)
+
+P.grid(True)
+P.ylim(0, 1.05)
+
+
+#
+# histogram has the ability to plot multiple data in parallel ...
+#
+P.figure()
+
+# create a new data-set
+x = mu + sigma*P.randn(1000,3)
+
+n, bins, patches = P.hist(x, 10, normed=1, histtype='bar')
+
+#
+# ... or we can stack the data
+#
+P.figure()
+
+n, bins, patches = P.hist(x, 10, normed=1, histtype='barstacked')
+
+
+P.show()
\ No newline at end of file
Deleted: trunk/matplotlib/examples/pylab/histogram_demo_step.py
===================================================================
--- trunk/matplotlib/examples/pylab/histogram_demo_step.py 2008-05-22 21:49:25 UTC (rev 5220)
+++ trunk/matplotlib/examples/pylab/histogram_demo_step.py 2008-05-23 07:51:20 UTC (rev 5221)
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-from pylab import *
-
-mu, sigma = 100, 15
-x = mu + sigma*randn(10000)
-
-# the histogram of the data
-n, bins, patches = hist(x, 50, normed=1, histtype='step')
-setp(patches, 'facecolor', 'g', 'alpha', 0.75)
-
-# add a 'best fit' line
-y = normpdf( bins, mu, sigma)
-l = plot(bins, y, 'k--', linewidth=1)
-
-
-# overlay the first histogram with a second one
-# were the data has a smaller standard deviation
-mu, sigma = 100, 5
-x = mu + sigma*randn(10000)
-
-n, bins, patches = hist(x, 50, normed=1, histtype='step')
-setp(patches, 'facecolor', 'r', 'alpha', 0.25)
-
-y = normpdf( bins, mu, sigma)
-l = plot(bins, y, 'k--', linewidth=1)
-
-axis([40, 160, 0, 0.09])
-grid(True)
-
-#savefig('histogram_demo',dpi=72)
-show()
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-05-22 21:49:25 UTC (rev 5220)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-05-23 07:51:20 UTC (rev 5221)
@@ -5392,7 +5392,8 @@
right
"""
- ax2 = self.figure.add_axes(self.get_position(True), sharex=self, frameon=False)
+ ax2 = self.figure.add_axes(self.get_position(True), sharex=self,
+ frameon=False)
ax2.yaxis.tick_right()
ax2.yaxis.set_label_position('right')
self.yaxis.tick_left()
@@ -5408,7 +5409,8 @@
top
"""
- ax2 = self.figure.add_axes(self.get_position(True), sharey=self, frameon=False)
+ ax2 = self.figure.add_axes(self.get_position(True), sharey=self,
+ frameon=False)
ax2.xaxis.tick_top()
ax2.xaxis.set_label_position('top')
self.xaxis.tick_bottom()
@@ -5420,16 +5422,19 @@
def hist(self, x, bins=10, normed=False, cumulative=False,
bottom=None, histtype='bar', align='edge',
- orientation='vertical', width=None, log=False, **kwargs):
+ orientation='vertical', rwidth=None, log=False, **kwargs):
"""
HIST(x, bins=10, normed=False, cumulative=False,
bottom=None, histtype='bar', align='edge',
- orientation='vertical', width=None, log=False, **kwargs)
+ orientation='vertical', rwidth=None, log=False, **kwargs)
Compute the histogram of x. bins is either an integer number of
bins or a sequence giving the bins. x are the data to be binned.
+ x can be an array or a 2D array with multiple data in its columns.
- The return values is (n, bins, patches)
+ The return values is (n, bins, patches) or
+ ([n0,n1,...], bins, [patches0,patches1,...]) if the input
+ contains multiple data.
If normed is true, the first element of the return tuple will
be the counts normalized to form a probability density, ie,
@@ -5442,22 +5447,25 @@
If cumulative is True then a histogram is computed where each bin
gives the counts in that bin plus all bins for smaller values.
- The last bins gives the total number of datapoints. If normed is
+ The last bin gives the total number of datapoints. If normed is
also True then the histogram is normalized such that the last bin
equals one.
- histtype = 'bar' | 'step'. The type of histogram to draw.
- 'bar' is a traditional bar-type histogram, 'step' generates
- a lineplot.
+ histtype = 'bar' | 'barstacked' | 'step'. The type of histogram
+ to draw. 'bar' is a traditional bar-type histogram, 'barstacked'
+ is a bar-type histogram where multiple data are stacked on top
+ of each other, and 'step' generates a lineplot.
- align = 'edge' | 'center'. Interprets bins either as edge
- or center values
+ align controles how the histogram is plotted
+ - 'edge' : bars are centered between the bin edges
+ - 'center': bars are centered on the left bin edges
orientation = 'horizontal' | 'vertical'. If horizontal, barh
will be used and the "bottom" kwarg will be the left edges.
- width: the width of the bars. If None, automatically compute
- the width. Ignored for 'step' histtype.
+ rwidth: the relative width of the bars as fraction of the bin
+ width. If None, automatically compute the width. Ignored
+ for 'step' histtype.
log: if True, the histogram axis will be set to a log scale
@@ -5466,25 +5474,86 @@
%(Rectangle)s
"""
if not self._hold: self.cla()
- n, bins = np.histogram(x, bins, range=None,
- normed=bool(normed), new=True)
+ if kwargs.get('width') is not None:
+ raise DeprecationWarning(
+ 'hist now uses the rwidth to give relative width and not absolute width')
+
+ # todo: make hist() work with list of arrays with different lengths
+ x = np.asarray(x)
+ if len(x.shape)==2:
+ n = []
+ for i in xrange(x.shape[1]):
+ # this will automatically overwrite bins,
+ # so that each histogram uses the same bins
+ m, bins = np.histogram(x[:,i], bins, range=None,
+ normed=bool(normed), new=True)
+ n.append(m)
+ else:
+ n, bins = np.histogram(x, bins, range=None,
+ normed=bool(normed), new=True)
+ n = [n,]
+
if cumulative:
if normed:
- n = (n * np.diff(bins)).cumsum()
+ n = [(m * np.diff(bins)).cumsum() for m in n]
else:
- n = n.cumsum()
+ n = [m.cumsum() for m in n]
- if histtype == 'bar':
- if width is None:
- width = 0.9*(bins[1]-bins[0])
+ ccount = 0
+ colors = _process_plot_var_args.defaultColors[:]
+ patches = []
+ if histtype.startswith('bar'):
+ totwidth = np.diff(bins)
+ stacked = False
+
+ if rwidth is not None: dr = min(1., max(0., rwidth))
+ elif len(n)>1: dr = 0.8
+ else: dr = 1.0
+
+ if histtype=='bar':
+ width = dr*totwidth/len(n)
+ dw = width
+
+ if len(n)>1:
+ boffset = -0.5*dr*totwidth*(1.-1./len(n))
+ else:
+ boffset = 0.0
+ elif histtype=='barstacked':
+ width = dr*totwidth
+ boffset, dw = 0.0, 0.0
+
+ stacked = True
+ if bottom is None: bottom = 0.0
+ else:
+ raise ValueError, 'invalid histtype: %s' % histtype
+
+ if align=='edge':
+ boffset += 0.5*totwidth
+ elif align != 'center':
+ raise ValueError, 'invalid align: %s' % align
+
if orientation == 'horizontal':
- patches = self.barh(bins[:-1], n, height=width, left=bottom,
- align=align, log=log)
+ for m in n:
+ color = colors[ccount % len(colors)]
+ patch = self.barh(bins[:-1]+boffset, m, height=width,
+ left=bottom, align='center', log=log,
+ color=color)
+ patches.append(patch)
+ if stacked: bottom += m
+ boffset += dw
+ ccount += 1
elif orientation == 'vertical':
- patches = self.bar(bins[:-1], n, width=width, bottom=bottom,
- align=align, log=log)
+ for m in n:
+ color = colors[ccount % len(colors)]
+ patch = self.bar(bins[:-1]+boffset, m, width=width,
+ bottom=bottom, align='center', log=log,
+ color=color)
+ patches.append(patch)
+ if stacked: bottom += m
+ boffset += dw
+ ccount += 1
else:
raise ValueError, 'invalid orientation: %s' % orientation
@@ -5493,22 +5562,29 @@
y = np.zeros( 2*len(bins), np.float_ )
x[0::2], x[1::2] = bins, bins
- y[1:-1:2], y[2::2] = n, n
if align == 'center':
x -= 0.5*(bins[1]-bins[0])
+ elif align != 'edge':
+ raise ValueError, 'invalid align: %s' % align
- if orientation == 'horizontal':
- x,y = y,x
- elif orientation != 'vertical':
- raise ValueError, 'invalid orientation: %s' % orientation
- patches = self.fill(x,y)
+ for m in n:
+ y[1:-1:2], y[2::2] = m, m
+ if orientation == 'horizontal':
+ x,y = y,x
+ elif orientation != 'vertical':
+ raise ValueError, 'invalid orientation: %s' % orientation
+ patches.append( self.fill(x,y) )
else:
raise ValueError, 'invalid histtype: %s' % histtype
-
- for p in patches:
- p.update(kwargs)
- return n, bins, cbook.silent_list('Patch', patches)
+
+ for patch in patches:
+ for p in patch:
+ p.update(kwargs)
+ if len(n)==1:
+ return n[0], bins, cbook.silent_list('Patch', patches[0])
+ else:
+ return n, bins, cbook.silent_list('Lists of Patches', patches)
hist.__doc__ = cbook.dedent(hist.__doc__) % martist.kwdocd
def psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-22 21:49:30
|
Revision: 5220
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5220&view=rev
Author: dsdale
Date: 2008-05-22 14:49:25 -0700 (Thu, 22 May 2008)
Log Message:
-----------
added a section to the dev guide explaining how to get up and running
with Sphinx
Modified Paths:
--------------
trunk/matplotlib/doc/users_guide/source/developerguide.txt
Added Paths:
-----------
trunk/matplotlib/doc/users_guide/source/documenting_mpl.txt
Modified: trunk/matplotlib/doc/users_guide/source/developerguide.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/source/developerguide.txt 2008-05-22 21:02:08 UTC (rev 5219)
+++ trunk/matplotlib/doc/users_guide/source/developerguide.txt 2008-05-22 21:49:25 UTC (rev 5220)
@@ -8,4 +8,5 @@
:maxdepth: 3
coding_guide
+ documenting_mpl
add_new_projection
Added: trunk/matplotlib/doc/users_guide/source/documenting_mpl.txt
===================================================================
--- trunk/matplotlib/doc/users_guide/source/documenting_mpl.txt (rev 0)
+++ trunk/matplotlib/doc/users_guide/source/documenting_mpl.txt 2008-05-22 21:49:25 UTC (rev 5220)
@@ -0,0 +1,43 @@
+**********************
+Documenting Matplotlib
+**********************
+
+The documentation for matplotlib is generated from ReStructured Text
+using the Sphinx_ documentation generation tool. Sphinx-0.4 or later
+is required to generate xml files to render mathematical expressions
+with mathml. Currently this means we need to install from the svn
+repository by doing::
+
+ svn co http://svn.python.org/projects/doctools/trunk sphinx
+ cd sphinx
+ python setup.py install
+
+.. _Sphinx: http://sphinx.pocoo.org/
+
+The documentation sources are found in the doc/ directory in the trunk.
+To build the users guid in html format, cd into doc/users_guide and do::
+
+ python make.py html
+
+you can also pass a ``latex`` flag to make.py to build a pdf, or pass no
+arguments to build everything. The same procedure can be followed for
+the sources in doc/api_reference.
+
+The actual ReStructured Text files are kept in doc/users_guide/source
+and doc/api_reference/source. The main entry point is index.txt.
+Additional files can be added by including their base file name
+(dropping the .txt extension) in the table of contents. It is also
+possible to include other documents through the use of an include
+statement. For example, in the Developers Guide, index.txt lists
+coding_guide, which automatically inserts coding_guide.txt.
+coding_guide.txt is just a placeholder, it contains one line only to
+gets its contents from the CODING_GUIDE file in the trunk:
+``.. include:: ../../CODING_GUIDE``.
+
+The output produced by Sphinx can be configured by editing the conf.py
+files located in the documentation source directories.
+
+The Sphinx website contains plenty of documentation_ concerning ReST
+markup and working with Sphinx in general.
+
+.. _documentation: http://sphinx.pocoo.org/contents.html
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-22 21:02:14
|
Revision: 5219
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5219&view=rev
Author: dsdale
Date: 2008-05-22 14:02:08 -0700 (Thu, 22 May 2008)
Log Message:
-----------
forgot to commit the CHANGELOG
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-22 21:01:40 UTC (rev 5218)
+++ trunk/matplotlib/CHANGELOG 2008-05-22 21:02:08 UTC (rev 5219)
@@ -1,3 +1,10 @@
+2008-05-22 Added support for ReST-based doumentation using Sphinx.
+ Documents are located in doc/, and are broken up into
+ a users guide and an API reference. To build, run the
+ make.py files. Sphinx-0.4 is needed to build generate xml,
+ which will be useful for rendering equations with mathml,
+ use sphinx from svn until 0.4 is released - DSD
+
2008-05-21 Fix segfault in TkAgg backend - MGD
2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-22 21:01:47
|
Revision: 5218
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5218&view=rev
Author: dsdale
Date: 2008-05-22 14:01:40 -0700 (Thu, 22 May 2008)
Log Message:
-----------
minor changes to docstring formatting to support ReST
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/dviread.py
trunk/matplotlib/lib/matplotlib/texmanager.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-05-22 19:58:22 UTC (rev 5217)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-05-22 21:01:40 UTC (rev 5218)
@@ -2722,9 +2722,7 @@
#### Basic plotting
def plot(self, *args, **kwargs):
"""
- PLOT(*args, **kwargs)
-
- Plot lines and/or markers to the Axes. *args is a variable length
+ Plot lines and/or markers to the Axes. ``*args`` is a variable length
argument, allowing for multiple x,y pairs with an optional format
string. For example, each of the following is legal
@@ -2744,32 +2742,32 @@
The following line styles are supported:
- - : solid line
- -- : dashed line
- -. : dash-dot line
- : : dotted line
- . : points
- , : pixels
- o : circle symbols
- ^ : triangle up symbols
- v : triangle down symbols
- < : triangle left symbols
- > : triangle right symbols
- s : square symbols
- + : plus symbols
- x : cross symbols
- D : diamond symbols
- d : thin diamond symbols
- 1 : tripod down symbols
- 2 : tripod up symbols
- 3 : tripod left symbols
- 4 : tripod right symbols
- h : hexagon symbols
- H : rotated hexagon symbols
- p : pentagon symbols
- | : vertical line symbols
- _ : horizontal line symbols
- steps : use gnuplot style 'steps' # kwarg only
+ * - : solid line
+ * -- : dashed line
+ * -. : dash-dot line
+ * : : dotted line
+ * . : points
+ * , : pixels
+ * o : circle symbols
+ * ^ : triangle up symbols
+ * v : triangle down symbols
+ * < : triangle left symbols
+ * > : triangle right symbols
+ * s : square symbols
+ * + : plus symbols
+ * x : cross symbols
+ * D : diamond symbols
+ * d : thin diamond symbols
+ * 1 : tripod down symbols
+ * 2 : tripod up symbols
+ * 3 : tripod left symbols
+ * 4 : tripod right symbols
+ * h : hexagon symbols
+ * H : rotated hexagon symbols
+ * p : pentagon symbols
+ * | : vertical line symbols
+ * _ : horizontal line symbols
+ * steps : use gnuplot style 'steps' # kwarg only
The following color abbreviations are supported
@@ -2792,8 +2790,8 @@
Line styles and colors are combined in a single format string, as in
'bo' for blue circles.
- The **kwargs can be used to set line properties (any property that has
- a set_* method). You can use this to set a line label (for auto
+ The ``**kwargs`` can be used to set line properties (any property that has
+ a ``set_*`` method). You can use this to set a line label (for auto
legends), linewidth, anitialising, marker face color, etc. Here is an
example:
Modified: trunk/matplotlib/lib/matplotlib/dviread.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/dviread.py 2008-05-22 19:58:22 UTC (rev 5217)
+++ trunk/matplotlib/lib/matplotlib/dviread.py 2008-05-22 21:01:40 UTC (rev 5218)
@@ -3,17 +3,18 @@
limitations make this not (currently) useful as a general-purpose dvi
preprocessor.
-Interface:
+Interface::
- dvi = Dvi(filename, 72)
- for page in dvi: # iterate over pages
- w, h, d = page.width, page.height, page.descent
- for x,y,font,glyph,width in page.text:
- fontname = font.texname
- pointsize = font.size
- ...
- for x,y,height,width in page.boxes:
- ...
+ dvi = Dvi(filename, 72)
+ for page in dvi: # iterate over pages
+ w, h, d = page.width, page.height, page.descent
+ for x,y,font,glyph,width in page.text:
+ fontname = font.texname
+ pointsize = font.size
+ ...
+ for x,y,height,width in page.boxes:
+ ...
+
"""
import matplotlib
@@ -419,12 +420,13 @@
class Vf(Dvi):
"""
- A virtual font (*.vf file) containing subroutines for dvi files.
+ A virtual font (\*.vf file) containing subroutines for dvi files.
- Usage:
- vf = Vf(filename)
- glyph = vf[code]
- glyph.text, glyph.boxes, glyph.width
+ Usage::
+
+ vf = Vf(filename)
+ glyph = vf[code]
+ glyph.text, glyph.boxes, glyph.width
"""
def __init__(self, filename):
@@ -526,12 +528,16 @@
minimum needed by the Dvi class.
Attributes:
+
checksum: for verifying against dvi file
+
design_size: design size of the font (in what units?)
- width[i]: width of character #i, needs to be scaled
+
+ width[i]: width of character \#i, needs to be scaled
by the factor specified in the dvi file
(this is a dict because indexing may not start from 0)
- height[i], depth[i]: height and depth of character #i
+
+ height[i], depth[i]: height and depth of character \#i
"""
__slots__ = ('checksum', 'design_size', 'width', 'height', 'depth')
@@ -665,13 +671,14 @@
class Encoding(object):
"""
- Parses a *.enc file referenced from a psfonts.map style file.
+ Parses a \*.enc file referenced from a psfonts.map style file.
The format this class understands is a very limited subset of
PostScript.
- Usage (subject to change):
- for name in Encoding(filename):
- whatever(name)
+ Usage (subject to change)::
+
+ for name in Encoding(filename):
+ whatever(name)
"""
__slots__ = ('encoding',)
Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/texmanager.py 2008-05-22 19:58:22 UTC (rev 5217)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py 2008-05-22 21:01:40 UTC (rev 5218)
@@ -6,31 +6,31 @@
Requirements:
- tex
-
- *Agg backends: dvipng
-
- PS backend: latex w/ psfrag, dvips, and Ghostscript 8.51
+* latex
+* \*Agg backends: dvipng
+* PS backend: latex w/ psfrag, dvips, and Ghostscript 8.51
(older versions do not work properly)
Backends:
- Only supported on *Agg and PS backends currently
+* \*Agg
+* PS
+* PDF
-
For raster output, you can get RGBA numpy arrays from TeX expressions
-as follows
+as follows::
texmanager = TexManager()
- s = r'\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!'
+ s = '\\TeX\\ is Number $\\displaystyle\\sum_{n=1}^\\infty\\frac{-e^{i\pi}}{2^n}$!'
Z = self.texmanager.get_rgba(s, size=12, dpi=80, rgb=(1,0,0))
To enable tex rendering of all text in your matplotlib figure, set
text.usetex in your matplotlibrc file (http://matplotlib.sf.net/matplotlibrc)
-or include these two lines in your script:
-from matplotlib import rc
-rc('text', usetex=True)
+or include these two lines in your script::
+ from matplotlib import rc
+ rc('text', usetex=True)
+
"""
import copy, glob, md5, os, shutil, sys
@@ -55,7 +55,9 @@
raise RuntimeError('Could not obtain dvipng version')
+
class TexManager:
+
"""
Convert strings to dvi files using TeX, caching the results to a
working dir
@@ -155,6 +157,9 @@
r'\usepackage{textcomp}'])
def get_basefile(self, tex, fontsize, dpi=None):
+ """
+ returns a filename based on a hash of the string, fontsize, and dpi
+ """
s = ''.join([tex, self.get_font_config(), '%f'%fontsize,
self.get_custom_preamble(), str(dpi or '')])
# make sure hash is consistent for all strings, regardless of encoding:
@@ -162,7 +167,7 @@
return os.path.join(self.texcache, md5.md5(bytes).hexdigest())
def get_font_config(self):
- "Reinitializes self if rcParams self depends on have changed."
+ """Reinitializes self if relevant rcParams on have changed."""
if self._rc_cache is None:
self._rc_cache = dict([(k,None) for k in self._rc_cache_keys])
changed = [par for par in self._rc_cache_keys if rcParams[par] != \
@@ -181,12 +186,16 @@
return self._fontconfig
def get_font_preamble(self):
+ """
+ returns a string containing font configuration for the tex preamble
+ """
return self._font_preamble
def get_custom_preamble(self):
+ """returns a string containing user additions to the tex preamble"""
return '\n'.join(rcParams['text.latex.preamble'])
- def get_shell_cmd(self, *args):
+ def _get_shell_cmd(self, *args):
"""
On windows, changing directories can be complicated by the presence of
multiple drives. get_shell_cmd deals with this issue.
@@ -199,6 +208,11 @@
return ' && '.join(command)
def make_tex(self, tex, fontsize):
+ """
+ Generate a tex file to render the tex string at a specific font size
+
+ returns the file name
+ """
basefile = self.get_basefile(tex, fontsize)
texfile = '%s.tex'%basefile
fh = file(texfile, 'w')
@@ -241,14 +255,18 @@
return texfile
def make_dvi(self, tex, fontsize):
+ """
+ generates a dvi file containing latex's layout of tex string
+ returns the file name
+ """
basefile = self.get_basefile(tex, fontsize)
dvifile = '%s.dvi'% basefile
if DEBUG or not os.path.exists(dvifile):
texfile = self.make_tex(tex, fontsize)
outfile = basefile+'.output'
- command = self.get_shell_cmd('cd "%s"'% self.texcache,
+ command = self._get_shell_cmd('cd "%s"'% self.texcache,
'latex -interaction=nonstopmode %s > "%s"'\
%(os.path.split(texfile)[-1], outfile))
mpl.verbose.report(command, 'debug')
@@ -267,6 +285,11 @@
return dvifile
def make_png(self, tex, fontsize, dpi):
+ """
+ generates a png file containing latex's rendering of tex string
+
+ returns the filename
+ """
basefile = self.get_basefile(tex, fontsize, dpi)
pngfile = '%s.png'% basefile
@@ -274,7 +297,7 @@
if DEBUG or not os.path.exists(pngfile):
dvifile = self.make_dvi(tex, fontsize)
outfile = basefile+'.output'
- command = self.get_shell_cmd('cd "%s"' % self.texcache,
+ command = self._get_shell_cmd('cd "%s"' % self.texcache,
'dvipng -bg Transparent -D %s -T tight -o \
"%s" "%s" > "%s"'%(dpi, os.path.split(pngfile)[-1],
os.path.split(dvifile)[-1], outfile))
@@ -292,14 +315,18 @@
return pngfile
def make_ps(self, tex, fontsize):
+ """
+ generates a postscript file containing latex's rendering of tex string
+ returns the file name
+ """
basefile = self.get_basefile(tex, fontsize)
psfile = '%s.epsf'% basefile
if DEBUG or not os.path.exists(psfile):
dvifile = self.make_dvi(tex, fontsize)
outfile = basefile+'.output'
- command = self.get_shell_cmd('cd "%s"'% self.texcache,
+ command = self._get_shell_cmd('cd "%s"'% self.texcache,
'dvips -q -E -o "%s" "%s" > "%s"'\
%(os.path.split(psfile)[-1],
os.path.split(dvifile)[-1], outfile))
@@ -317,6 +344,10 @@
return psfile
def get_ps_bbox(self, tex, fontsize):
+ """
+ returns a list containing the postscript bounding box for latex's
+ rendering of the tex string
+ """
psfile = self.make_ps(tex, fontsize)
ps = file(psfile)
for line in ps:
@@ -325,6 +356,7 @@
raise RuntimeError('Could not parse %s'%psfile)
def get_grey(self, tex, fontsize=None, dpi=None):
+ """returns the alpha channel"""
key = tex, self.get_font_config(), fontsize, dpi
alpha = self.grey_arrayd.get(key)
@@ -344,7 +376,7 @@
def get_rgba(self, tex, fontsize=None, dpi=None, rgb=(0,0,0)):
"""
- Return tex string as an rgba array
+ Returns latex's rendering of the tex string as an rgba array
"""
# dvipng assumes a constant background, whereas we want to
# overlay these rasters with antialiasing over arbitrary
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-22 19:58:44
|
Revision: 5217
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5217&view=rev
Author: dsdale
Date: 2008-05-22 12:58:22 -0700 (Thu, 22 May 2008)
Log Message:
-----------
added support for ReST-based documentation using Sphinx
Added Paths:
-----------
trunk/matplotlib/doc/CODING_GUIDE
trunk/matplotlib/doc/api_reference/
trunk/matplotlib/doc/api_reference/make.py
trunk/matplotlib/doc/api_reference/source/
trunk/matplotlib/doc/api_reference/source/_static/
trunk/matplotlib/doc/api_reference/source/_templates/
trunk/matplotlib/doc/api_reference/source/conf.py
trunk/matplotlib/doc/api_reference/source/figures/
trunk/matplotlib/doc/api_reference/source/figures/make.py
trunk/matplotlib/doc/api_reference/source/figures/matplotlibrc
trunk/matplotlib/doc/api_reference/source/index.txt
trunk/matplotlib/doc/api_reference/source/introduction.txt
trunk/matplotlib/doc/api_reference/source/latex.txt
trunk/matplotlib/doc/sphinxext/
trunk/matplotlib/doc/sphinxext/mathml.py
trunk/matplotlib/doc/users_guide/
trunk/matplotlib/doc/users_guide/make.py
trunk/matplotlib/doc/users_guide/source/
trunk/matplotlib/doc/users_guide/source/_static/
trunk/matplotlib/doc/users_guide/source/_templates/
trunk/matplotlib/doc/users_guide/source/add_new_projection.txt
trunk/matplotlib/doc/users_guide/source/artist_api_tut.txt
trunk/matplotlib/doc/users_guide/source/coding_guide.txt
trunk/matplotlib/doc/users_guide/source/conf.py
trunk/matplotlib/doc/users_guide/source/developerguide.txt
trunk/matplotlib/doc/users_guide/source/event_handling_tut.txt
trunk/matplotlib/doc/users_guide/source/figures/
trunk/matplotlib/doc/users_guide/source/figures/dollar_ticks.py
trunk/matplotlib/doc/users_guide/source/figures/fig_axes_customize_simple.py
trunk/matplotlib/doc/users_guide/source/figures/fig_axes_labels_simple.py
trunk/matplotlib/doc/users_guide/source/figures/fig_x.py
trunk/matplotlib/doc/users_guide/source/figures/make.py
trunk/matplotlib/doc/users_guide/source/figures/matplotlibrc
trunk/matplotlib/doc/users_guide/source/index.txt
trunk/matplotlib/doc/users_guide/source/introduction.txt
trunk/matplotlib/doc/users_guide/source/userguide.txt
Removed Paths:
-------------
trunk/matplotlib/doc/artist_api_tut.txt
trunk/matplotlib/doc/devel/
trunk/matplotlib/doc/event_handling_tut.txt
trunk/matplotlib/doc/figures/
Added: trunk/matplotlib/doc/CODING_GUIDE
===================================================================
--- trunk/matplotlib/doc/CODING_GUIDE (rev 0)
+++ trunk/matplotlib/doc/CODING_GUIDE 2008-05-22 19:58:22 UTC (rev 5217)
@@ -0,0 +1,317 @@
+***************
+Version Control
+***************
+
+svn checkouts
+=============
+
+Checking out everything in the trunk (matplotlib and toolkits)::
+
+ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk \
+ matplotlib --username=youruser --password=yourpass
+
+Checking out the main source::
+
+ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/\
+ matplotlib matplotlib --username=youruser --password=yourpass
+
+Branch checkouts, eg the maintenance branch::
+
+ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\
+ v0_91_maint mplv0_91_maint
+
+Committing changes
+==================
+
+When committing changes to matplotlib, there are a few things to bear
+in mind.
+
+* if your changes are non-trivial, please make an entry in the
+ CHANGELOG
+* if you change the API, please document it in API_CHANGES, and
+ consider posting to mpl-devel
+* Are your changes python2.3 compatible? We are still trying to
+ support 2.3, so avoid 2.4 only features like decorators until we
+ remove 2.3 support
+* Can you pass examples/backend_driver.py? This is our poor man's
+ unit test.
+* If you have altered extension code, do you pass
+ unit/memleak_hawaii.py?
+* if you have added new files or directories, or reorganized
+ existing ones, are the new files included in the match patterns in
+ MANIFEST.in. This file determines what goes into the src
+ distribution of the mpl build.
+* Keep the maintenance branch and trunk in sync where it makes sense.
+ If there is a bug on both that needs fixing, use svnmerge.py to
+ keep them in sync. http://www.orcaware.com/svn/wiki/Svnmerge.py. The
+ basic procedure is:
+
+ * install svnmerge.py in your PATH::
+
+ wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/\
+ svnmerge/svnmerge.py
+
+ * get a svn copy of the maintenance branch and the trunk (see above)
+ * Michael advises making the change on the branch and committing
+ it. Make sure you svn upped on the trunk and have no local
+ modifications, and then from the svn trunk do::
+
+ > svnmerge.py merge -rNNN1,NNN2
+
+ where the NNN* are the revision numbers. Ranges arealso acceptable.
+ svnmergy.py automatically creates a file containing the commit messages,
+ so you are ready to make the commit::
+
+ > svn commit -F svnmerge-commit-message.txt
+
+***********
+Style Guide
+***********
+
+Importing and name spaces
+=========================
+
+For numpy, use::
+
+ import numpy as np
+ a = np.array([1,2,3])
+
+For masked arrays, use::
+
+ from numpy import ma
+
+(The earlier recommendation, 'import matplotlib.numerix.npyma as ma',
+was needed temporarily during the development of the maskedarray
+implementation as a separate package. As of numpy 1.1, it replaces the
+old implementation. Note: "from numpy import ma" works with numpy < 1.1
+*and* with numpy >= 1.1. "import numpy.ma as ma" works *only* with
+numpy >= 1.1, so for now we must not use it.)
+
+For matplotlib main module, use::
+
+ import matplotlib as mpl
+ mpl.rcParams['xtick.major.pad'] = 6
+
+For matplotlib modules (or any other modules), use::
+
+ import matplotlib.cbook as cbook
+
+ if cbook.iterable(z):
+ pass
+
+We prefer this over the equivalent 'from matplotlib import cbook'
+because the latter is ambiguous whether cbook is a module or a
+function to the new developer. The former makes it explcit that
+you are importing a module or package.
+
+Naming, spacing, and formatting conventions
+===========================================
+
+In general, we want to hew as closely as possible to the standard
+coding guidelines for python written by Guido in
+http://www.python.org/dev/peps/pep-0008, though we do not do this
+throughout.
+
+* functions and class methods: lower or lower_underscore_separated
+
+* attributes and variables: lower or lowerUpper
+
+* classes: Upper or MixedCase
+
+Personally, I prefer the shortest names that are still readable.
+
+Also, use an editor that does not put tabs in files. Four spaces
+should be used for indentation everywhere and if there is a file with
+tabs or more or less spaces it is a bug -- please fix it.
+
+Please avoid spurious invisible spaces at the ends of lines.
+(Tell your editor to strip whitespace from line ends when saving
+a file.)
+
+Keep docstrings uniformly indented as in the example below, with
+nothing to the left of the triple quotes. The dedent() function
+is needed to remove excess indentation only if something will be
+interpolated into the docstring, again as in the example above.
+
+Limit line length to 80 characters. If a logical line needs to be
+longer, use parentheses to break it; do not use an escaped
+newline. It may be preferable to use a temporary variable
+to replace a single long line with two shorter and more
+readable lines.
+
+Please do not commit lines with trailing white space, as it causes
+noise in svn diffs. If you are an emacs user, the following in your
+.emacs will cause emacs to strip trailing white space on save for
+python, C and C++::
+
+ ; and similarly for c++-mode-hook and c-mode-hook
+ (add-hook 'python-mode-hook
+ (lambda ()
+ (add-hook 'write-file-functions 'delete-trailing-whitespace)))
+
+for older versions of emacs (emacs<22) you need to do::
+
+ (add-hook 'python-mode-hook
+ (lambda ()
+ (add-hook 'local-write-file-hooks 'delete-trailing-whitespace)))
+
+Keyword argument processing
+===========================
+
+Matplotlib makes extensive use of ``**kwargs`` for pass through
+customizations from one function to another. A typical example is in
+pylab.text, The definition of the pylab text function is a simple
+pass-through to axes.Axes.text::
+
+ # in pylab.py
+ def text(*args, **kwargs):
+ ret = gca().text(*args, **kwargs)
+ draw_if_interactive()
+ return ret
+
+axes.Axes.text in simplified form looks like this, ie it just passes
+them on to text.Text.__init__::
+
+ # in axes.py
+ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
+ t = Text(x=x, y=y, text=s, **kwargs)
+
+and Text.__init__ (again with liberties for illustration) just passes
+them on to the artist.Artist.update method::
+
+ # in text.py
+ def __init__(self, x=0, y=0, text='', **kwargs):
+ Artist.__init__(self)
+ self.update(kwargs)
+
+'update' does the work looking for methods named like 'set_property'
+if 'property' is a keyword argument. Ie, noone looks at the keywords,
+they just get passed through the API to the artist constructor which
+looks for suitably named methods and calls them with the value.
+
+As a general rule, the use of ``**kwargs`` should be reserved for
+pass-through keyword arguments, as in the examaple above. If I intend
+for all the keyword args to be used in some function and not passed
+on, I just use the key/value keyword args in the function definition
+rather than the ``**kwargs`` idiom.
+
+In some cases I want to consume some keys and pass through the others,
+in which case I pop the ones I want to use locally and pass on the
+rest, eg I pop scalex and scaley in Axes.plot and assume the rest are
+Line2D keyword arguments. As an example of a pop, passthrough
+usage, see Axes.plot::
+
+ # in axes.py
+ def plot(self, *args, **kwargs):
+ scalex = kwargs.pop('scalex', True)
+ scaley = kwargs.pop('scaley', True)
+ if not self._hold: self.cla()
+ lines = []
+ for line in self._get_lines(*args, **kwargs):
+ self.add_line(line)
+ lines.append(line)
+
+The matplotlib.cbook function popd() is rendered
+obsolete by the pop() dictionary method introduced in Python 2.3,
+so it should not be used for new code.
+
+Note there is a use case when kwargs are meant to be used locally in
+the function (not passed on), but you still need the ``**kwargs`` idiom.
+That is when you want to use ``*args`` to allow variable numbers of
+non-keyword args. In this case, python will not allow you to use
+named keyword args after the ``*args`` usage, so you will be forced to use
+``**kwargs``. An example is matplotlib.contour.ContourLabeler.clabel::
+
+ # in contour.py
+ def clabel(self, *args, **kwargs):
+ fontsize = kwargs.get('fontsize', None)
+ inline = kwargs.get('inline', 1)
+ self.fmt = kwargs.get('fmt', '%1.3f')
+ colors = kwargs.get('colors', None)
+ if len(args) == 0:
+ levels = self.levels
+ indices = range(len(self.levels))
+ elif len(args) == 1:
+ ...etc...
+
+Documentation and Docstrings
+============================
+
+matplotlib uses artist instrospection of docstrings to support
+properties. All properties that you want to support through setp and
+getp should have a set_property and get_property method in the Artist
+class. Yes, this is not ideal given python properties or enthought
+traits, but it is a historical legacy for now. The setter methods use
+the docstring with the ACCEPTS token to indicate the type of argument
+the method accepts. Eg in matplotlib.lines.Line2D::
+
+ # in lines.py
+ def set_linestyle(self, linestyle):
+ """
+ Set the linestyle of the line
+
+ ACCEPTS: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' | ' ' | '' ]
+ """
+
+Since matplotlib uses a lot of pass through kwargs, eg in every
+function that creates a line (plot, semilogx, semilogy, etc...), it
+can be difficult for the new user to know which kwargs are supported.
+I have developed a docstring interpolation scheme to support
+documentation of every function that takes a ``**kwargs``. The
+requirements are:
+
+1. single point of configuration so changes to the properties don't
+ require multiple docstring edits
+
+2. as automated as possible so that as properties change the docs
+ are updated automagically.
+
+I have added a matplotlib.artist.kwdocd and kwdoc() to faciliate this.
+They combines python string interpolation in the docstring with the
+matplotlib artist introspection facility that underlies setp and getp.
+The kwdocd is a single dictionary that maps class name to a docstring
+of kwargs. Here is an example from matplotlib.lines::
+
+ # in lines.py
+ artist.kwdocd['Line2D'] = artist.kwdoc(Line2D)
+
+Then in any function accepting Line2D passthrough kwargs, eg
+matplotlib.axes.Axes.plot::
+
+ # in axes.py
+ def plot(self, *args, **kwargs):
+ """
+ Some stuff omitted
+
+ The kwargs are Line2D properties:
+ %(Line2D)s
+
+ kwargs scalex and scaley, if defined, are passed on
+ to autoscale_view to determine whether the x and y axes are
+ autoscaled; default True. See Axes.autoscale_view for more
+ information
+ """
+ pass
+ plot.__doc__ = cbook.dedent(plot.__doc__) % artist.kwdocd
+
+Note there is a problem for Artist __init__ methods, eg Patch.__init__
+which supports Patch kwargs, since the artist inspector cannot work
+until the class is fully defined and we can't modify the
+Patch.__init__.__doc__ docstring outside the class definition. I have
+made some manual hacks in this case which violates the "single entry
+point" requirement above; hopefully we'll find a more elegant solution
+before too long
+
+********
+Licenses
+********
+
+Matplotlib only uses BSD compatible code. If you bring in code from
+another project make sure it has a PSF, BSD, MIT or compatible
+license. If not, you may consider contacting the author and asking
+them to relicense it. GPL and LGPL code are not acceptible in the
+main code base, though we are considering an alternative way of
+distributing L/GPL code through an separate channel, possibly a
+toolkit. If you include code, make sure you include a copy of that
+code's license in the license directory if the code's license requires
+you to distribute the license with it.
\ No newline at end of file
Added: trunk/matplotlib/doc/api_reference/make.py
===================================================================
--- trunk/matplotlib/doc/api_reference/make.py (rev 0)
+++ trunk/matplotlib/doc/api_reference/make.py 2008-05-22 19:58:22 UTC (rev 5217)
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+import fileinput
+import glob
+import os
+import shutil
+import sys
+
+def check_build():
+ build_dirs = ['build', 'build/doctrees', 'build/html', 'build/latex',
+ 'source/_static', 'source/_templates']
+ for d in build_dirs:
+ try:
+ os.mkdir(d)
+ except OSError:
+ pass
+
+def figs():
+ os.system('cd source/figures/ && python make.py')
+
+def html():
+ check_build()
+ os.system('sphinx-build -b html -d build/doctrees source build/html')
+
+def latex():
+ if sys.platform != 'win32':
+ # LaTeX format.
+ os.system('sphinx-build -b latex -d build/doctrees source build/latex')
+
+ # Produce pdf.
+ os.chdir('build/latex')
+
+ # Copying the makefile produced by sphinx...
+ os.system('pdflatex Matplotlib_API_Reference.tex')
+ os.system('pdflatex Matplotlib_API_Reference.tex')
+ os.system('makeindex -s python.ist Matplotlib_API_Reference.idx')
+ os.system('makeindex -s python.ist modMatplotlib_API_Reference.idx')
+ os.system('pdflatex Matplotlib_API_Reference.tex')
+
+ os.chdir('../..')
+ else:
+ print 'latex build has not been tested on windows'
+
+def clean():
+ shutil.rmtree('build')
+
+def all():
+ figs()
+ html()
+ latex()
+
+
+funcd = {'figs':figs,
+ 'html':html,
+ 'latex':latex,
+ '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()
\ No newline at end of file
Property changes on: trunk/matplotlib/doc/api_reference/make.py
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Added: trunk/matplotlib/doc/api_reference/source/conf.py
===================================================================
--- trunk/matplotlib/doc/api_reference/source/conf.py (rev 0)
+++ trunk/matplotlib/doc/api_reference/source/conf.py 2008-05-22 19:58:22 UTC (rev 5217)
@@ -0,0 +1,155 @@
+# -*- coding: utf-8 -*-
+#
+# Matplotlib documentation build configuration file, created by
+# sphinx-quickstart on Fri May 2 12:33:25 2008.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default value; values that are commented out
+# serve to show the default value.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+sys.path.append(os.path.abspath('../../sphinxext'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['mathml', 'sphinx.ext.autodoc']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.txt'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General substitutions.
+project = 'Matplotlib'
+copyright = '2008, John Hunter, Darren Dale'
+
+# The default replacements for |version| and |release|, also used in various
+# other places throughout the built documents.
+#
+# The short X.Y version.
+version = '0.98'
+# The full version, including alpha/beta/rc tags.
+release = '0.98pre'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# The name of an image file (within the static path) to place at the top of
+# the sidebar.
+#html_logo = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If nonempty, this is the file name suffix for generated HTML files. The
+# default is ``".html"``.
+html_file_suffix = '.xml'
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.
+html_use_opensearch = 'False'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'Matplotlib_API_doc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+latex_font_size = '11pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+ ('index', 'Matplotlib_API_Reference.tex', 'Matplotlib API Reference', 'John Hunter, Darren Dale', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+latex_logo = None
+
+# Additional stuff for the LaTeX preamble.
+latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+latex_appendices = []
+
+# If false, no module index is generated.
+latex_use_modindex = True
+
+latex_use_parts = True
Property changes on: trunk/matplotlib/doc/api_reference/source/conf.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/matplotlib/doc/api_reference/source/figures/make.py
===================================================================
--- trunk/matplotlib/doc/api_reference/source/figures/make.py (rev 0)
+++ trunk/matplotlib/doc/api_reference/source/figures/make.py 2008-05-22 19:58:22 UTC (rev 5217)
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+import sys, os, glob
+import matplotlib
+matplotlib.rcdefaults()
+matplotlib.use('Agg')
+
+def figs():
+ # each one of these will make a figure when imported
+ # ...
+
+ print 'all figures made'
+ for fname in glob.glob('*.pyc'):
+ os.remove(fname)
+
+def clean():
+ patterns = ['#*', '*~', '*.png']
+ 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()
+
+
+
+
Property changes on: trunk/matplotlib/doc/api_reference/source/figures/make.py
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Added: trunk/matplotlib/doc/api_reference/source/figures/matplotlibrc
===================================================================
Added: trunk/matplotlib/doc/api_reference/source/index.txt
===================================================================
--- trunk/matplotlib/doc/api_reference/source/index.txt (rev 0)
+++ trunk/matplotlib/doc/api_reference/source/index.txt 2008-05-22 19:58:22 UTC (rev 5217)
@@ -0,0 +1,14 @@
+.. Matplotlib documentation master file.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+.. _contents:
+
+Matplotlib API Reference
+========================
+
+.. toctree::
+ :maxdepth: 4
+
+ introduction
+ latex
Property changes on: trunk/matplotlib/doc/api_reference/source/index.txt
___________________________________________________________________
Name: svn:eol-style
+ CRLF
Added: trunk/matplotlib/doc/api_reference/source/introduction.txt
===================================================================
--- trunk/matplotlib/doc/api_reference/source/introduction.txt (rev 0)
+++ trunk/matplotlib/doc/api_reference/source/introduction.txt 2008-05-22 19:58:22 UTC (rev 5217)
@@ -0,0 +1,4 @@
+************
+Introduction
+************
+
Property changes on: trunk/matplotlib/doc/api_reference/source/introduction.txt
___________________________________________________________________
Name: svn:eol-style
+ CRLF
Added: trunk/matplotlib/doc/api_reference/source/latex.txt
===================================================================
--- trunk/matplotlib/doc/api_reference/source/latex.txt (rev 0)
+++ trunk/matplotlib/doc/api_reference/source/latex.txt 2008-05-22 19:58:22 UTC (rev 5217)
@@ -0,0 +1,25 @@
+############################################
+Matplotlib Application Programming Interface
+############################################
+
+*************
+LaTeX Support
+*************
+
+:mod:`matplotlib.texmanager`
+=============================
+
+.. automodule:: matplotlib.texmanager
+ :members:
+
+:mod:`matplotlib.dviread`
+=============================
+
+.. automodule:: matplotlib.dviread
+ :members:
+
+:mod:`matplotlib.axes`
+=============================
+
+.. autoclass:: matplotlib.axes.Axes
+ :members: plot
\ No newline at end of file
Property changes on: trunk/matplotlib/doc/api_reference/source/latex.txt
___________________________________________________________________
Name: svn:eol-style
+ CRLF
Deleted: trunk/matplotlib/doc/artist_api_tut.txt
===================================================================
--- trunk/matplotlib/doc/artist_api_tut.txt 2008-05-22 18:16:43 UTC (rev 5216)
+++ trunk/matplotlib/doc/artist_api_tut.txt 2008-05-22 19:58:22 UTC (rev 5217)
@@ -1,597 +0,0 @@
-The matplotlib Artist API tutorial
-==================================
-
-There are three layers to the matplotlib API. The FigureCanvas is the
-area onto which the figure is drawn, the Renderer is the object which
-knows how to draw on the FigureCanvas, and the Artist is the object
-that knows how to use a renderer to paint onto the canvas. The
-FigureCanvas and Renderer handle all the details of talking to user
-interface toolkits like wxpython or drawing languages like postscript,
-and the Artist handles all the high level constructs like
-representing and laying out the figure, text, and lines. The typical
-user will spend 95% of his time working with the Artists.
-
-There are two types Artists: primitives and containers. The
-primitives represent the standard graphical objects we want to paint
-onto our canvas: Line2D, Rectangle, Text, AxesImage, etc, and the
-containers are places to put them (Axis, Axes and Figure). The
-standard use is to create a Figure instance, use the Figure to create
-one or more Axes or Subplot instances, and use the Axes instance
-helper methods to create the primitives. In the example below, we
-create a Figure instance using pyplot.figure, which is a convenience
-method for instantiating Figure instances and connecting them with
-your user interface or drawing toolkit FigureCanvas. As we will
-discuss below, this is not necessary, and you can work directly with
-postscript, pdf gtk, or wxpython FigureCanvas es, instantiate your
-Figures directly and connect them yourselves, but since we are
-focusing here on the Artist API we'll let pyplot handle some of those
-details for us::
-
- import matplotlib.pyplot as plt
- fig = plt.figure()
- ax = fig.add_subplot(2,1,1) # two rows, one column, first plot
-
-The Axes is probably the most important class in the matplotlib API,
-and the one you will be working with most of the time. This is
-because the Axes is the plotting area into which most of the objects
-go, and the Axes has many special helper methods (ax.plot, ax.text,
-ax.hist, ax.imshow) to create the most common graphics primitives
-(Line2D, Text, Rectangle, Image, respectively). These helper methods
-will take your data (eg numpy arrays and strings) create primitive
-Artist instances as needed (eg Line2D), add them to the relevant
-containers, and draw them when requested. Most of you are probably
-familiar with the Subplot, which is just a special case of an Axes
-that lives on a regular rows by columns grid of Subplot instances. If
-you want to create an Axes at an arbitrary location, simply use the
-add_axes method which takes a list of [left, bottom, width, height]
-values in 0-1 relative figure coordinates::
-
- ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
-
-Continuing with our example::
-
- import numpy as np
- 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)
-
-In this example, ax is the Axes instance created by the
-fig.add_subplot call above (remember Subplot is just a subclass of
-Axes) and when you call ax.plot, it creates a Line2D instance and adds
-it the the Axes.lines list. In the interactive ipython session below,
-you can see that Axes.lines list is length one and contains the same
-line that was returned by the "line, ax.plot(x, y, 'o')" call::
-
- In [101]: ax.lines[0]
- Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710>
-
- In [102]: line
- Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710>
-
-If you make subsequent calls to ax.plot (and the hold state is "on"
-which is the default) then additional lines will be added to the list.
-You can remove lines later simply by calling the list methods; either
-of these will work::
-
- del ax.lines[0]
- ax.lines.remove(line) # one or the other, not both!
-
-The Axes also has helper methods to configure and decorate the xaxis
-and yaxis tick, ticklabels and axis labels::
-
- xtext = ax.set_xlabel('my xdata') # returns a Text instance
- ytext = ax.set_ylabel('my xdata')
-
-When you call ax.set_xlabel, it passes the information on the Text
-instance of the XAxis. Each Axes instance contains an xaxis and a
-yaxis instance, which handle the layout and drawing of the ticks, tick
-labels and axis labels.
-
-Here are the most important matplotlib modules that contain the
-classes referenced above
-
-=============== ==================
-Artist Module
-=============== ==================
-Artist matplotlib.artist
-Rectangle matplotlib.patches
-Line2D matplotlib.lines
-Axes matplotlib.axes
-XAxis and YAxis matplotlib.axis
-Figure matplotlib.figure
-Text matplotlib.text
-=============== ==================
-
-Try creating the figure below
-
-.. image:: figures/fig_axes_labels_simple.png
- :scale: 75
-
-Customizing your objects
-========================
-
-Every element in the figure is represented by a matplotlib Artist, and
-each has an extensive list of properties to configure its appearance.
-The figure itself contains a Rectangle exactly the size of the figure,
-which you can use to set the background color and transparency of the
-figures. Likewise, each Axes bounding box (the standard white box
-with black edges in the typical matplotlib plot, has a Rectangle
-instance that determines the color, transparency, and other properties
-of the Axes. These instances are stored as member variables
-Figure.figurePatch and Axes.axesPatch ("Patch" is a name inherited
-from Matlab, and is a 2D "patch" of color on the figure, eg
-rectangles, circles and polygons). Every matplotlib Artist has the
-following properties
-
-========== ======================================================================
-Property Description
-========== ======================================================================
-alpha The transparency - a scalar from 0-1
-animated A boolean that is used to facilitate animated drawing
-axes The axes that the Artist lives in, possibly None
-clip_box The bounding box that clips the Artist
-clip_on Whether clipping is enabled
-clip_path The path the artist is clipped to
-contains A picking function to test whether the artist contains the pick point
-figure The figure instance the aritst lives in, possibly None
-label A text label (eg for auto-labeling)
-picker A python object that controls object picking
-transform The transformation
-visible A boolean whether the artist should be drawn
-zorder A number which determines the drawing order
-========== ======================================================================
-
-Each of the properties is accessed with an old-fashioned setter or
-getter (yes we know this irritates pythonistas and we plan to support
-direct access via properties or traits but it hasn't been done yet).
-For example, to multiply the current alpha by a half::
-
- a = o.get_alpha()
- o.set_alpha(0.5*a)
-
-If you want to set a number of properties at once, you can also use
-the "set" method with keyword arguments. For example::
-
- o.set(alpha=0.5, zorder=2)
-
-If you are working interactively at the python shell, a handy way to
-inspect the artist properties is to use the matplotlib.artist.getp
-method, which lists the properties and their values (simply "getp") in
-pylab. This works for classes derived from Artist as well, eg Figure
-and Rectangle. Here are the Figure rectangle properties mentioned above::
-
-
- In [149]: matplotlib.artist.getp(fig.figurePatch)
- alpha = 1.0
- animated = False
- antialiased or aa = True
- axes = None
- clip_box = None
- clip_on = False
- clip_path = None
- contains = None
- edgecolor or ec = w
- facecolor or fc = 0.75
- figure = Figure(8.125x6.125)
- fill = 1
- hatch = None
- height = 1
- label =
- linewidth or lw = 1.0
- picker = None
- transform = <Affine object at 0x134cca84>
- verts = ((0, 0), (0, 1), (1, 1), (1, 0))
- visible = True
- width = 1
- window_extent = <Bbox object at 0x134acbcc>
- x = 0
- y = 0
- zorder = 1
-
-The docstrings for all of the classes also contain the artist
-properties, so you can consult the interactive "help", the online html
-docs at http://matplotlib.sourceforge.net/classdocs.html or PDF documentation
-at http://matplotlib.sourceforge.net/api.pdf for a listing of
-properties for a give object.
-
-Getting at the objects to customize them
-========================================
-
-Now that we know how to inspect set the properties of a given
-object we want to configure, we need to now how to get at that
-object. As mentioned in the introduction, there are two kinds of
-objects: primitives and containers. The primitives are usually the
-things you want to configure (the font of a Text instance, the width
-of a Line2D) although the containers also have some properties as
-well -- for example the Axes Artist is a container that contains many
-of the primitives in your plot, but it also has properties like the
-xscale to control whether the xaxis is 'linear' or 'log'. In this
-section we'll review where the various container objects store the
-Artists that you want to get at.
-
-The Figure container
---------------------
-
-The top level container Artist is the matplotlib.figure.Figure, and it
-contains everything in the figure. The background of the figure is a
-Rectangle which is stored in fig.figurePatch (where fig is your Figure
-instance). As you add subplots (fig.add_subplot) and axes
-(ax.add_axes)to the figure these will be appended to the fig.axes
-list. These are also returned by the methods that create them::
-
- In [156]: fig = plt.figure()
-
- In [157]: ax1 = fig.add_subplot(211)
-
- In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3])
-
- In [159]: ax1
- Out[159]: <matplotlib.axes.Subplot instance at 0xd54b26c>
-
- In [160]: print fig.axes
- [<matplotlib.axes.Subplot instance at 0xd54b26c>, <matplotlib.axes.Axes instance at 0xd3f0b2c>]
-
-
-Because the figure maintains the concept of the "current axes" (see
-Figure.gca and Figure.sca) to support the pylab/pyplot state machine,
-you should not insert or remove axes directly from the axes list, but
-rather use the Figure.add_axes and Figure.add_subplot method to
-insert, and the Figure.delaxes methods to delete. You are free
-however, to iterate over the list of axes or index into it to get
-access to Axes instances you want to customize. Here is an example
-which turns all the axes grids on::
-
- for ax in fig.axes:
- ax.grid(True)
-
-
-The figure also has its own text, lines, patches and images, which you
-can use to add primitives directly. The default coordinate system for
-the Figure will simply be in pixels (which is not usually what you
-want) but you can control this by setting the transform property of
-the Artist you are adding to the figure. More useful is "figure
-coordinates" where 0,0 is the bottom, left of the figure and 1,1 is
-the top, right of the figure which you can obtain by setting the
-Artist transform to fig.transFigure::
-
- In [191]: fig = plt.figure()
-
- In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
-
- In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
-
- In [194]: fig.lines.extend([l1, l2])
-
- In [195]: fig.canvas.draw()
-
-.. image:: figures/fig_x.png
- :scale: 75
-
-
-Here is a summary of the Artists the figure contains
-
-================ ===============================================================
-Figure attribute Description
-================ ===============================================================
-axes A list of Axes instances (includes Subplot)
-figurePatch The Rectangle background
-images A list of FigureImages patches - useful for raw pixel display
-legends A list of Figure Legend instances (different from Axes.legends)
-lines A list of Figure Line2D instances (rarely used, see Axes.lines)
-patches A list of Figure patches (rarely used, see Axes.patches)
-texts A list Figure Text instances
-================ ===============================================================
-
-
-The Axes container
-------------------
-
-The matplotlib.axes.Axes is the center of the matplotlib universe --
-it contains the vast majority of all the Artists used in a figure with
-many helper methods to create and these Artists to itself, as well as
-helper methods to access and customize the Artists it contains. Like
-the Figure, it contains a Patch ax.axesPatch which is Rectangle for
-Cartesian coordinates and a Circle for polar coordinates; this patch
-determines the shape, background and border of the plotting region::
-
- ax = fig.add_subplot(111)
- rect = ax.axesPatch # a Rectangle instance
- rect.set_facecolor('green')
-
-When you call a plotting method, eg the canonical "ax.plot" and pass
-in arrays or list of values, the method will a matplotlib.lines.Line2D
-instance, update the line with all the Line2D properties passed as
-keyword arguments, add the line to the Axes.lines container, and
-returns it to you::
-
- In [213]: x, y = np.random.rand(2, 100)
-
- In [214]: line, = ax.plot(x, y, '-', color='blue', linewidth=2)
-
-ax.plot returns a list of lines because you can pass in multiple x, y
-pairs to plot, and we are unpacking the first element of the length
-one list into the line variable. The line has been added to the
-ax.lines list::
-
-
- In [229]: print ax.lines
- [<matplotlib.lines.Line2D instance at 0xd378b0c>]
-
-Similarly, methods that create patches, like ax.bar creates a list of
-rectangles, will add the patches to the ax.patches list::
-
- In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow')
-
- In [234]: rectangles
- Out[234]: <a list of 50 Patch objects>
-
- In [235]: print len(ax.patches)
-
-You should not add objects directly to the ax.lines or ax.patches
-unless you know exactly what you are doing, because the Axes needs to
-do a few things when it creates and adds an object. It sets the figure
-and axes property of the Artist, as well as the default Axes
-transformation (unless a transformation is set). It also inspects the
-data contained in the Artist to update the data structures controlling
-auto-scaling, so that the view limits can be adjusted to contain the
-plotted data. You can, nonetheless, create objects yourself and add
-them directly to the Axes using helper methods like ax.add_line and
-ax.add_patch. Here is an annotated interactive session illustrating
-what is going on::
-
- In [261]: fig = plt.figure()
-
- In [262]: ax = fig.add_subplot(111)
-
- # create a rectangle instance
- In [263]: rect = matplotlib.patches.Rectangle( (1,1), width=5, height=12)
-
- # by default the axes instance is None
- In [264]: print rect.get_axes()
- None
-
- # and the transformation instance is set to the "identity transform"
- In [265]: print rect.get_transform()
- <Affine object at 0x13695544>
-
- # now we add the Rectangle to the Axes
- In [266]: ax.add_patch(rect)
-
- # and notice that the ax.add_patch method has set the axes
- # instance
- In [267]: print rect.get_axes()
- Subplot(49,81.25)
-
- # and the transformation has been set too
- In [268]: print rect.get_transform()
- <Affine object at 0x15009ca4>
-
- # the default axes transformation is ax.transData
- In [269]: print ax.transData
- <Affine object at 0x15009ca4>
-
- # notice that the xlimits of the Axes have not been changed
- In [270]: print ax.get_xlim()
- (0.0, 1.0)
-
- # but the data limits have been updated to encompass the rectangle
- In [271]: print ax.dataLim.get_bounds()
- (1.0, 1.0, 5.0, 12.0)
-
- # we can manually invoke the auto-scaling machinery
- In [272]: ax.autoscale_view()
-
- # and now the xlim are updated to encompass the rectangle
- In [273]: print ax.get_xlim()
- (1.0, 6.0)
-
- # we have to manually force a figure draw
- In [274]: ax.figure.canvas.draw()
-
-
-There are many, many Axes helper methods for creating primitive
-Artists and adding them to their respective containers. The table
-below summarizes a small sampling of them, the kinds of Artist they
-create, and where they store them
-
-============================== ==================== =======================
-Helper method Artist Container
-============================== ==================== =======================
-ax.annotate - text annotations Annotate ax.texts
-ax.bar - bar charts Rectangle ax.patches
-ax.errorbar - error bar plots Line2D and Rectangle ax.lines and ax.patches
-ax.fill - shared area Polygon ax.patches
-ax.hist - histograms Rectangle ax.patches
-ax.imshow - image data AxesImage ax.images
-ax.legend - axes legends Legend ax.legends
-ax.plot - xy plots Line2D ax.lines
-ax.scatter - scatter charts PolygonCollection ax.collections
-ax.text - text Text ax.texts
-============================== ==================== =======================
-
-
-In addition to all of these Artists, the Axes contains two important
-Artist containers: the XAxis and YAxis, which handle the drawing of
-the ticks and labels. These are stored as instance variables xaxis
-and yaxis. The XAxis and YAxis containers will be detailed below, but
-note that the Axes contains many helper methods which forward calls on
-to the Axis instances so you often do not need to work with them
-directly unless you want to. For example, you can set the fontsize of
-the XAxis ticklabels using the Axes helper method::
-
- for label in ax.get_xticklabels():
- label.set_color('orange')
-
-Below is a summary of the Artists that the Axes contains
-
-============== ======================================
-Axes attribute Description
-============== ======================================
-artists A list of Artist instances
-axesPatch Rectangle instance for Axes background
-collections A list of Collection instances
-images A list of AxesImage
-legends A list of Legend instances
-lines A list of Line2D instances
-patches A list of Patch instances
-texts A list of Text instances
-xaxis matplotlib.axis.XAxis instance
-yaxis matplotlib.axis.YAxis instance
-============== ======================================
-
-The Axis containers
--------------------
-
-The matplotlib.axis.Axis instances handle the drawing of the tick lines, the grid
-lines, the tick labels and the axis label. You can configure the left
-and right ticks separately for the y axis, and the upper and lower
-ticks separately for the x axis. The axis also stores the data and view
-intervals used in auto-scaling, panning and zooming, as well as the
-locator and formatter instances which control where the ticks are
-placed and how they are represented as strings.
-
-Each axis object contains a label attribute (this is what the pylab
-calls to xlabel and ylabel set) as well as a list of major and minor
-ticks. The ticks are XTick and YTick instances, which contain the
-actual line and text primitives that render the ticks and ticklabels.
-Because the ticks are dynamically created as needed (eg when panning
-and zooming), you should access the lists of major and minor ticks
-through their accessor methods axis.get_major_ticks() and
-axis.get_minor_ticks(). Although the ticks contain all the primitives
-and will be covered below, the Axis methods contain accessor methods
-to return the tick lines, tick labels, tick locations etc....::
-
- In [285]: axis = ax.xaxis
-
- In [286]: axis.get_ticklocs()
- Out[286]: array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
-
- In [287]: axis.get_ticklabels()
- Out[287]: <a list of 10 Text major ticklabel objects>
-
- # note there are twice as many ticklines as labels because by
- # default there are tick lines at the top and bottom but only tick
- # labels below the xaxis; this can be customized
- In [288]: axis.get_ticklines()
- Out[288]: <a list of 20 Line2D ticklines objects>
-
- # by default you get the major ticks back
- In [291]: axis.get_ticklines()
- Out[291]: <a list of 20 Line2D ticklines objects>
-
- # but you can also ask for the minor ticks
- In [292]: axis.get_ticklines(minor=True)
- Out[292]: <a list of 0 Line2D ticklines objects>
-
-Here is a summary of some of the useful accessor methods of the Axis
-(these have corresponding setters where useful, such as
-set_major_formatter)
-
-====================== =========================================================
-Accessor method Description
-====================== =========================================================
-get_scale The scale of the axis, eg 'log' or 'linear'
-get_view_interval The interval instance of the axis view limits
-get_data_interval The interval instance of the axis data limits
-get_gridlines A list of grid lines for the Axis
-get_label The axis label - a Text instance
-get_ticklabels A list of Text instances - keyword minor=True|False
-get_ticklines A list of Line2D instances - keyword minor=True|False
-get_ticklocs A list of Tick locations - keyword minor=True|False
-get_major_locator The matplotlib.ticker.Locator instance for major ticks
-get_major_formatter The matplotlib.ticker.Formatter instance for major ticks
-get_minor_locator The matplotlib.ticker.Locator instance for minor ticks
-get_minor_formatter The matplotlib.ticker.Formatter instance for minor ticks
-get_major_ticks A list of Tick instances for major ticks
-get_minor_ticks A list of Tick instances for minor ticks
-grid Turn the grid on or off for the major or minor ticks
-====================== =========================================================
-
-Try creating the figure below
-
-.. image:: figures/fig_axes_customize_simple.png
- :scale: 75
-
-Exercise solution::
-
- 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)
-
- fig.savefig('figures/fig_axes_customize_simple.png', dpi=150)
- fig.savefig('figures/fig_axes_customize_simple.eps')
- plt.show()
-
-
-
-The Tick containers
--------------------
-
-The matplotlib.axis.Tick is the final container object in our descent
-from the Figure to the Axes to the Axis to the Tick. The Tick
-contains the tick and grid line instances, as well as the label
-instances for the upper and lower ticks. Each of these is accessible
-directly as an attribute of the Tick. In addition, there are boolean
-variables that determine whether the upper labels and ticks are on for
-the xaxis and whether the right labels and ticks are on for the yaxis.
-
-============== ==========================================================
-Tick attribute Description
-============== ==========================================================
-tick1line Line2D instance
-tick2line Line2D instance
-gridline Line2D instance
-label1 Text instance
-label2 Text instance
-gridOn boolean which determines whether to draw the tickline
-tick1On boolean which determines whether to draw the 1st tickline
-tick2On boolean which determines whether to draw the 2nd tickline
-label1On boolean which determines whether to draw tick label
-label2On boolean which determines whether to draw tick label
-============== ==========================================================
-
-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::
-
- 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')
-
- plt.show()
-
-
-.. image:: figures/dollar_ticks.png
- :scale: 75
Deleted: trunk/matplotlib/doc/event_handling_tut.txt
===================================================================
--- trunk/matplotlib/doc/event_handling_tut.txt 2008-05-22 18:16:43 UTC (rev 5216)
+++ trunk/matplotlib/doc/event_handling_tut.txt 2008-05-22 19:58:22 UTC (rev 5217)
@@ -1,470 +0,0 @@
-Event Handling and Picking Tutorial
-===================================
-
-matplotlib works with 5 user interface toolkits (wxpython, tkinter,
-qt, gtk and fltk) and in order to support features like interactive
-panning and zooming of figures, it is helpful to the developers to
-have an API for interacting with the figure via key presses and mouse
-movements that is "GUI neutral" so we don't have to repeat a lot of
-code across the different user interfaces. Although the event
-handling API is GUI neutral, it is based on the GTK model, which was
-the first user interface matplotlib supported. The events that are
-triggered are also a bit richer vis-a-vis matplotlib than standard GUI
-events, including information like which Axes the event occurred in.
-The events also understand the matplotlib coordinate system, and
-report event locations in both pixel and data coordinates.
-
-
-Event connections
-=================
-
-To receive events, you need to write a callback function and then
-connect your function to the event manager, which is part of the
-FigureCanvas. Here is a simple example that prints the location of
-the mouse click and which button was pressed::
-
- fig = plt.figure()
- ax = fig.add_subplot(111)
- ax.plot(np.random.rand(10))
-
- def onclick(event):
- print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(
- event.button, event.x, event.y, event.xdata, event.ydata)
-
- cid = fig.canvas.mpl_connect('button_press_event', onclick)
-
-The FigureCanvas method mpl_connect returns a connection id which is
-simply an integer. When you want to disconnect the callback, just
-call::
-
- fig.canvas.mpl_disconnect(cid)
-
-Here are the events that you can connect to, the class instances that
-are sent back to you when the event occurs, and the event descriptions
-
-
-===================== =========== ===================================
-Event name Class Description
-===================== =========== ===================================
-button_press_event MouseEvent mouse button is pressed
-button_release_event MouseEvent mouse button is released
-draw_event DrawEvent canvas draw
-key_press_event KeyEvent key is pressed
-key_release_event KeyEvent key is released
-motion_notify_event MouseEvent mouse motion
-pick_event PickEvent an object in the canvas is selected
-resize_event ResizeEvent figure canvas is resized
-scroll_event MouseEvent mouse scroll wheel is rolled
-===================== =========== ===================================
-
-
-Event attributes
-================
-
-All matplotlib events inherit from the base class
-matplotlib.backend_bases.Event, which store the attributes
-
-=============== =================================================
-Event attribute Description
-=============== =================================================
-name the event name
-canvas the FigureCanvas instance generating the event
-guiEvent the GUI event that triggered the matplotlib event
-=============== =================================================
-
-The most common events that are the bread and butter of event handling
-are key press/release events and mouse press/release and movement
-events. The KeyEvent and MouseEvent classes that handle these events
-are both derived from the LocationEvent, which has the following
-attributes
-
-======================= ========================================
-LocationEvent attribute Description
-======================= ========================================
-x x position - pixels from left of canvas
-y y position - pixels from right of canvas
-button button pressed None, 1, 2, 3
-inaxes the Axes instance if mouse us over axes
-xdata x coord of mouse in data coords
-ydata y coord of mouse in data coords
-======================= ========================================
-
-Let's look a simple example of a canvas, where a simple line segment
-is created every time a mouse is pressed::
-
- class LineBuilder:
- def __init__(self, line):
- self.line = line
- self.xs = list(line.get_xdata())
- self.ys = list(line.get_ydata())
- self.cid = line.figure.canvas.mpl_connect('button_press_event', self)
-
- def __call__(self, event):
- print 'click', event
- if event.inaxes!=self.line.axes: return
- self.xs.append(event.xdata)
- self.ys.append(event.ydata)
- self.line.set_data(self.xs, self.ys)
- self.line.figure.canvas.draw()
-
- fig = plt.figure()
- ax = fig.add_subplot(111)
- ax.set_title('click to build line segments')
- line, = ax.plot([0], [0]) # empty line
- linebuilder = LineBuilder(line)
-
-
-
-The MouseEvent that we just used is a LocationEvent, so we have access
-to the data and pixel coordinates in event.x and event.xdata. In
-addition to the LocationEvent attributes, it has
-
-==================== ==============================================================
-MouseEvent attribute Description
-==================== ==============================================================
-button button pressed None, 1, 2, 3
-key the key pressed: None, chr(range(255)), shift, win, or control
-==================== ==============================================================
-
-Draggable Rectangle Exercise
-----------------------------
-
-Write draggable rectangle class that is initialized with a Rectangle
-instance but will move its x,y location when dragged. Hint: you will
-need to store the orginal xy location of the rectangle which is stored
-as rect.xy and connect to the press, motion and release mouse events.
-When the mouse is pressed, check to see if the click occurs over your
-rectangle (see rect.contains) and if it does, store the rectangle xy
-and the location of the mouse click in data coords. In the motion
-event callback, compute the deltax and deltay of the mouse movement,
-and add those deltas to the origin of the rectangle you stored. The
-redraw the figure. On the button release event, just reset all the
-button press data you stored as None.
-
-Here is the solution::
-
- import numpy as np
- import matplotlib.pyplot as plt
-
- class DraggableRectangle:
- def __init__(self, rect):
- self.rect = rect
- self.press = None
-
- def connect(self):
- 'connect to all the events we need'
- self.cidpress = self.rect.figure.canvas.mpl_connect(
- 'button_press_event', self.on_press)
- self.cidrelease = self.rect.figure.canvas.mpl_connect(
- 'button_release_event', self.on_release)
- self.cidmotion = self.rect.figure.canvas.mpl_connect(
- 'motion_notify_event', self.on_motion)
-
- def on_press(self, event):
- 'on button press we will see if the mouse is over us and store some data'
- if event.inaxes != self.rect.axes: return
-
- contains, attrd = self.rect.contains(event)
- if not contains: return
- print 'event contains', self.rect.xy
- x0, y0 = self.rect.xy
- self.press = x0, y0, event.xdata, event.ydata
-
- def on_motion(self, event):
- 'on motion we will move the rect if the mouse is over us'
- if self.press is None: return
- if event.inaxes != self.rect.axes: return
- x0, y0, xpress, ypress = self.press
- dx = event.xdata - xpress
- dy = event.ydata - ypress
- #print 'x0=%f, xpress=%f, event.xdata=%f, dx=%f, x0+dx=%f'%(x0, xpress, event.xdata, dx, x0+dx)
- self.rect.set_x(x0+dx)
- self.rect.set_y(y0+dy)
-
- self.rect.figure.canvas.draw()
-
-
- def on_release(self, event):
- 'on release we reset the press data'
- self.press = None
- self.rect.figure.canvas.draw()
-
- ...
[truncated message content] |
|
From: <jd...@us...> - 2008-05-22 18:17:03
|
Revision: 5216
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5216&view=rev
Author: jdh2358
Date: 2008-05-22 11:16:43 -0700 (Thu, 22 May 2008)
Log Message:
-----------
Merged revisions 5215 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r5215 | jdh2358 | 2008-05-22 13:14:59 -0500 (Thu, 22 May 2008) | 1 line
fixed a wx bug
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5213
+ /branches/v0_91_maint:1-5215
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-22 18:14:59 UTC (rev 5215)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-22 18:16:43 UTC (rev 5216)
@@ -1353,7 +1353,7 @@
def set_window_title(self, title):
self.window.SetTitle(title)
- def resize(self, width, height)
+ def resize(self, width, height):
'Set the canvas size in pixels'
self.canvas.SetInitialSize(wx.Size(width, height))
self.window.GetSizer().Fit(self.window)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-22 18:15:31
|
Revision: 5215
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5215&view=rev
Author: jdh2358
Date: 2008-05-22 11:14:59 -0700 (Thu, 22 May 2008)
Log Message:
-----------
fixed a wx bug
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py 2008-05-22 14:32:56 UTC (rev 5214)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py 2008-05-22 18:14:59 UTC (rev 5215)
@@ -1413,7 +1413,7 @@
def set_window_title(self, title):
self.window.SetTitle(title)
- def resize(self, width, height)
+ def resize(self, width, height):
'Set the canvas size in pixels'
self.canvas.SetInitialSize(wx.Size(width, height))
self.window.GetSizer().Fit(self.window)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-22 14:33:02
|
Revision: 5214
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5214&view=rev
Author: jdh2358
Date: 2008-05-22 07:32:56 -0700 (Thu, 22 May 2008)
Log Message:
-----------
Merged revisions 5211,5213 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r5211 | mdboom | 2008-05-21 08:06:51 -0500 (Wed, 21 May 2008) | 2 lines
Backport TkAgg segfault fix.
........
r5213 | jdh2358 | 2008-05-22 09:21:10 -0500 (Thu, 22 May 2008) | 1 line
applied stans wx figsize patch
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
trunk/matplotlib/lib/matplotlib/figure.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5207
+ /branches/v0_91_maint:1-5213
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-22 14:21:10 UTC (rev 5213)
+++ trunk/matplotlib/CHANGELOG 2008-05-22 14:32:56 UTC (rev 5214)
@@ -1,3 +1,5 @@
+2008-05-21 Fix segfault in TkAgg backend - MGD
+
2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM
2008-05-19 Fix crash when Windows can not access the registry to
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-22 14:21:10 UTC (rev 5213)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-22 14:32:56 UTC (rev 5214)
@@ -1226,14 +1226,15 @@
pos =wx.Point(20,20)
l,b,w,h = fig.bbox.bounds
wx.Frame.__init__(self, parent=None, id=-1, pos=pos,
- title="Figure %d" % num,
- size=(w,h))
+ title="Figure %d" % num)
+ # Frame will be sized later by the Fit method
DEBUG_MSG("__init__()", 1, self)
self.num = num
statbar = StatusBarWx(self)
self.SetStatusBar(statbar)
self.canvas = self.get_canvas(fig)
+ self.canvas.SetInitialSize(wx.Size(fig.bbox.width(), fig.bbox.height()))
self.sizer =wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
# By adding toolbar in sizer, we are able to put it at the bottom
@@ -1352,6 +1353,11 @@
def set_window_title(self, title):
self.window.SetTitle(title)
+ def resize(self, width, height)
+ 'Set the canvas size in pixels'
+ self.canvas.SetInitialSize(wx.Size(width, height))
+ self.window.GetSizer().Fit(self.window)
+
# Identifiers for toolbar controls - images_wx contains bitmaps for the images
# used in the controls. wxWindows does not provide any stock images, so I've
# 'stolen' those from GTK2, and transformed them into the appropriate format.
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py 2008-05-22 14:21:10 UTC (rev 5213)
+++ trunk/matplotlib/lib/matplotlib/figure.py 2008-05-22 14:32:56 UTC (rev 5214)
@@ -414,6 +414,7 @@
from the shell
WARNING: forward=True is broken on all backends except GTK*
+ and WX*
ACCEPTS: a w,h tuple with w,h in inches
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-22 14:21:17
|
Revision: 5213
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5213&view=rev
Author: jdh2358
Date: 2008-05-22 07:21:10 -0700 (Thu, 22 May 2008)
Log Message:
-----------
applied stans wx figsize patch
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py
branches/v0_91_maint/lib/matplotlib/figure.py
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py 2008-05-21 16:08:26 UTC (rev 5212)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py 2008-05-22 14:21:10 UTC (rev 5213)
@@ -1286,14 +1286,15 @@
pos =wx.Point(20,20)
l,b,w,h = fig.bbox.get_bounds()
wx.Frame.__init__(self, parent=None, id=-1, pos=pos,
- title="Figure %d" % num,
- size=(w,h))
+ title="Figure %d" % num)
+ # Frame will be sized later by the Fit method
DEBUG_MSG("__init__()", 1, self)
self.num = num
statbar = StatusBarWx(self)
self.SetStatusBar(statbar)
self.canvas = self.get_canvas(fig)
+ self.canvas.SetInitialSize(wx.Size(fig.bbox.width(), fig.bbox.height()))
self.sizer =wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
# By adding toolbar in sizer, we are able to put it at the bottom
@@ -1412,6 +1413,11 @@
def set_window_title(self, title):
self.window.SetTitle(title)
+ def resize(self, width, height)
+ 'Set the canvas size in pixels'
+ self.canvas.SetInitialSize(wx.Size(width, height))
+ self.window.GetSizer().Fit(self.window)
+
# Identifiers for toolbar controls - images_wx contains bitmaps for the images
# used in the controls. wxWindows does not provide any stock images, so I've
# 'stolen' those from GTK2, and transformed them into the appropriate format.
Modified: branches/v0_91_maint/lib/matplotlib/figure.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/figure.py 2008-05-21 16:08:26 UTC (rev 5212)
+++ branches/v0_91_maint/lib/matplotlib/figure.py 2008-05-22 14:21:10 UTC (rev 5213)
@@ -327,6 +327,7 @@
from the shell
WARNING: forward=True is broken on all backends except GTK*
+ and WX*
ACCEPTS: a w,h tuple with w,h in inches
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sa...@us...> - 2008-05-21 16:09:35
|
Revision: 5212
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5212&view=rev
Author: sameerd
Date: 2008-05-21 09:08:26 -0700 (Wed, 21 May 2008)
Log Message:
-----------
Record array append multiple fields
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-05-21 13:06:51 UTC (rev 5211)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-05-21 16:08:26 UTC (rev 5212)
@@ -1953,14 +1953,39 @@
def rec_append_field(rec, name, arr, dtype=None):
'return a new record array with field name populated with data from array arr'
- arr = np.asarray(arr)
- if dtype is None:
- dtype = arr.dtype
- newdtype = np.dtype(rec.dtype.descr + [(name, dtype)])
+ warnings.warn("use rec_append_fields", DeprecationWarning)
+ return rec_append_fields(rec, name, arr, dtype)
+
+def rec_append_fields(rec, names, arrs, dtypes=None):
+ """
+ return a new record array with field names populated with data
+ from arrays in arrs. If appending a single field then names, arrs
+ and dtypes do not have to be lists. They can just be the values themselves.
+ """
+ if (not cbook.is_string_like(names) and cbook.iterable(names) \
+ and len(names) and cbook.is_string_like(names[0])):
+ if len(names) != len(arrs):
+ raise ValueError, "number of arrays do not match number of names"
+ else: # we have only 1 name and 1 array
+ names = [names]
+ arrs = [arrs]
+ arrs = map(np.asarray, arrs)
+ if dtypes is None:
+ dtypes = [a.dtype for a in arrs]
+ elif not cbook.iterable(dtypes):
+ dtypes = [dtypes]
+ if len(arrs) != len(dtypes):
+ if len(dtypes) == 1:
+ dtypes = dtypes * len(arrs)
+ else:
+ raise ValueError, "dtypes must be None, a single dtype or a list"
+
+ newdtype = np.dtype(rec.dtype.descr + zip(names, dtypes))
newrec = np.empty(rec.shape, dtype=newdtype)
for field in rec.dtype.fields:
newrec[field] = rec[field]
- newrec[name] = arr
+ for name, arr in zip(names, arrs):
+ newrec[name] = arr
return newrec.view(np.recarray)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|