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: <fer...@us...> - 2008-10-19 06:59:04
|
Revision: 6262
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6262&view=rev
Author: fer_perez
Date: 2008-10-19 06:58:58 +0000 (Sun, 19 Oct 2008)
Log Message:
-----------
Workbook: complete updates to build.
Final round of fixes and updates for workbook to build correctly.
Added missing files, updated Makefile.
Modified Paths:
--------------
trunk/py4science/workbook/Makefile
trunk/py4science/workbook/update_problems.py
Added Paths:
-----------
trunk/py4science/workbook/bessel.tex
Removed Paths:
-------------
trunk/py4science/workbook/problems_solved
Modified: trunk/py4science/workbook/Makefile
===================================================================
--- trunk/py4science/workbook/Makefile 2008-10-19 04:21:03 UTC (rev 6261)
+++ trunk/py4science/workbook/Makefile 2008-10-19 06:58:58 UTC (rev 6262)
@@ -18,21 +18,25 @@
# convenience shorthand for targets
sol: workbook_solutions.pdf
skel: workbook_skeletons.pdf
-all: soln skel
+all: sol skel
# actual targets
-workbook_solutions.pdf: $(SOLN_SRC)
- ./update_problems.py
- rm -f problems
- ln -sf problems_soln problems
+workbook_solutions.pdf: prob_soln $(SOLN_SRC)
$(PDFTEX) workbook_solutions
$(PDFTEX) workbook_solutions
-workbook_skeletons.pdf: $(SKEL_SRC)
+workbook_skeletons.pdf: prob_skel $(SKEL_SRC)
+ $(PDFTEX) workbook_skeletons
+
+prob_soln:
+ rm -f problems
+ ln -sf problems_soln problems
./update_problems.py
+
+prob_skel:
rm -f problems
ln -sf problems_skel problems
- $(PDFTEX) workbook_skeletons
+ ./update_problems.py
workbook_skeletons.tex:
ln -sf main.tex workbook_skeletons.tex
@@ -56,4 +60,4 @@
$(FASTPDFTEX) $<
# Phony targets
-.PHONY: all clean
+.PHONY: all clean prob_soln prob_skel sol skel
Added: trunk/py4science/workbook/bessel.tex
===================================================================
--- trunk/py4science/workbook/bessel.tex (rev 0)
+++ trunk/py4science/workbook/bessel.tex 2008-10-19 06:58:58 UTC (rev 6262)
@@ -0,0 +1,46 @@
+\section{Bessel functions}
+\label{sec:bessel}
+
+In this exercise, you will verify a few simple relations involving the Bessel
+functions of the first kind. The important relations to keep in mind are the
+asymptotic form of $J_n(x)$ for $x>>n$:
+
+\begin{equation}
+J_n(x) \approx \sqrt(\frac{2}{\pi x})\cos(x-(n\frac{\pi}{2}+\frac{\pi}{4}))
+\end{equation}
+
+%
+and the recursion relation
+
+\begin{equation}
+J_{n+1}(x) = \frac{2n}{x} J_n(x)-J_{n-1}(x)
+\end{equation}
+
+\begin{figure}
+\begin{centering}
+\includegraphics[width=5in]{fig/bessel_functions}
+\par
+\end{centering}
+
+
+\caption{\label{fig:bessel_functions}A few Bessel functions.}
+
+\end{figure}
+
+
+
+\begin{figure}
+\begin{centering}
+\includegraphics[width=5in]{fig/bessel_error}
+\par
+\end{centering}
+
+
+\caption{\label{fig:bessel_error}Numerical error for $J_5$.}
+
+\end{figure}
+
+Once you get the code to run, you should see two figures like
+Figure~\ref{fig:bessel_functions} and Figure~\ref{fig:bessel_error}.
+
+\lstinputlisting[label={code:bessel},caption={IGNORED}]{problems/bessel.py}
Deleted: trunk/py4science/workbook/problems_solved
===================================================================
--- trunk/py4science/workbook/problems_solved 2008-10-19 04:21:03 UTC (rev 6261)
+++ trunk/py4science/workbook/problems_solved 2008-10-19 06:58:58 UTC (rev 6262)
@@ -1 +0,0 @@
-link ../examples
\ No newline at end of file
Modified: trunk/py4science/workbook/update_problems.py
===================================================================
--- trunk/py4science/workbook/update_problems.py 2008-10-19 04:21:03 UTC (rev 6261)
+++ trunk/py4science/workbook/update_problems.py 2008-10-19 06:58:58 UTC (rev 6262)
@@ -12,11 +12,11 @@
# Constants
SRC_DIR = '../examples'
UPDATE = './mkskel.py'
+PROBLEMS_DIR = 'problems'
-
if __name__ == '__main__':
- problems = [f for f in os.listdir('problems') if f.endswith('.py')]
+ problems = [f for f in os.listdir(PROBLEMS_DIR) if f.endswith('.py')]
os.chdir(SRC_DIR)
to_update = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fer...@us...> - 2008-10-19 04:21:05
|
Revision: 6261
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6261&view=rev
Author: fer_perez
Date: 2008-10-19 04:21:03 +0000 (Sun, 19 Oct 2008)
Log Message:
-----------
Workbook: small makefile fix
Modified Paths:
--------------
trunk/py4science/workbook/Makefile
Modified: trunk/py4science/workbook/Makefile
===================================================================
--- trunk/py4science/workbook/Makefile 2008-10-19 04:20:11 UTC (rev 6260)
+++ trunk/py4science/workbook/Makefile 2008-10-19 04:21:03 UTC (rev 6261)
@@ -44,7 +44,7 @@
rm -f *~ *.aux *.log *.toc *.out *.bbl *.blg *.fmt
distclean: clean
- rm -f workbook_solutions.pdf workbook_skeletons.pdf
+ rm -f workbook_solutions.pdf workbook_skeletons.pdf problems
# Basic rules
empty :=
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fer...@us...> - 2008-10-19 04:20:20
|
Revision: 6260
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6260&view=rev
Author: fer_perez
Date: 2008-10-19 04:20:11 +0000 (Sun, 19 Oct 2008)
Log Message:
-----------
Workbook: Add bessel examples, and jpg I forgot to commit before.
Added Paths:
-----------
trunk/py4science/workbook/fig/bessel_error.pdf
trunk/py4science/workbook/fig/bessel_functions.pdf
trunk/py4science/workbook/fig/mpl_ratner.jpg
trunk/py4science/workbook/problems_skel/bessel.py
Added: trunk/py4science/workbook/fig/bessel_error.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/py4science/workbook/fig/bessel_error.pdf
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/py4science/workbook/fig/bessel_functions.pdf
===================================================================
--- trunk/py4science/workbook/fig/bessel_functions.pdf (rev 0)
+++ trunk/py4science/workbook/fig/bessel_functions.pdf 2008-10-19 04:20:11 UTC (rev 6260)
@@ -0,0 +1,1685 @@
+%PDF-1.4
+%\xAC\xDC \xAB\xBA
+1 0 obj
+<< /Type /Catalog /Pages 3 0 R >>
+endobj
+2 0 obj
+<< /CreationDate (D:20081009025959-07'00')
+/Producer (matplotlib pdf backend)
+/Creator (matplotlib 0.98.3, http://matplotlib.sf.net) >>
+endobj
+3 0 obj
+<< /Count 1 /Kids [ 4 0 R ] /Type /Pages >>
+endobj
+4 0 obj
+<< /Contents 5 0 R /Type /Page /Resources 10 0 R /Parent 3 0 R
+/MediaBox [ 0 0 388.8 237.6 ] >>
+endobj
+10 0 obj
+<< /Pattern 8 0 R /XObject 9 0 R /Font 6 0 R /ExtGState 7 0 R
+/ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >>
+endobj
+5 0 obj
+<< /Filter /FlateDecode /Length 11 0 R >>
+stream
+x\x9C\xBD\xBD\xC9\xCE-Kr\xA5\xA7q<EɁ~\x86\xF7\xEE $\xA0A\x95РJ\x81b%\xDC$U"\x85\x82\xDE^\xEB3\xF3\x88\xBB\xDDc\xDFԥ\x9A"\x99\xC9s\x8E\xEF輱v-\xB3x\xFE\xE1\xE7?\xE8?{\\xE7u\xFE\xE9L\xBD\xFFt\xFD\xE9\x97\xF9\xA7\x98\xDAO\xD5߮\x8F?i\xF4\xF8k\xFD\xFE?\xEBO{\xE4\xAE\x8E\xE9\xA7U.\xCF\xE3g\xC4\xF9\xD7_\x9E\xBF^\xE1g\xF0w\xFF\xED\xFA7\xFF\xE9\xF1\x8E\xFF\xF4\xF9I?J\xF1\xAD\xFF\xC4\xF3\xFF\xFB\xF3<\xFF\xF1\x8C\xF6\xC4Ko\xFBo\xE7cC\x8F?\x81\xE7\xEA9\xA9\x94\xD0ۨc\xD8?_zL
+\xA3\xF2\xA0r\xFD\x84p\xA5VF]\xA3\xE1\xA7^!ī\xA6\xD6\xF4h
+\xF7ZJM\xE3\xB2\xE1\xEBg\\xB9\xE5Pr\xEE\\xAD\x9Fǫ\xD9ݛ\xDEH\x9F\x94\xD2ȹ\x86h\xC3\xF1g\xDE9\x8Fz\xF0\xC2uĞ\xAF؊=;\xFD\xE8=Bl=\x8C\xA2\xAB\xDBO\xE8\xB5\xF6K7PZ\xB7\xE1\xF2\x93c\xE8)\xC6xh0\xFFT\xBD\x86\xBDy\xD6`\xFA\xC9Wы\xE85\xED\xD6\xE5'\xE9Ghq$
+\x87\x9F\x90\xEBȱ\xB5\x90\xF8\xAC\xFA\xEE)\xD1LV\xBDX\xC9#\xE6\x96z\xE4\xEA\xAA\xCFlWm\xBA\xC3\xE5g\xE4Ks\x93\xAEj\x9F\xA5ծ1ڴ\x84#\xD4\xF4s\x85Bև\xD9p\xFFɡ\xE5\x9C\xEA\xA5\xF9.C_\xD1\xC7\xD0WE\xBB\xF7\xF8\xD1K\xCD\xCF\xD2p\xFD)\xAD\xF5\xAEo\xAE\xE3\xB0\xE1\xE1\x92mX\xF7\xB9^5vn]\xAF\x9F\xDA\xD3e3\xAE\xE5\xD0\xD2\xE6\x92j\xCDE\xA0Ϫ\xE1''\xBFV3r\xF9\xA9\xED\xD2\xD75\xADWkGh}z\xCAE\x93\xA4W\xFE\xD1\xE45\xBD\xE9\xC8ŇG\xACw9\x82\x{1B49A3}^M\xFF\x97\xD6\xE6\xBB7\x8A\x96#%-}\xD2khV\xC3Y\xB4T{>Bԫ\xA5+\x956\xE6\xCD\xCBO\xD4S\xE1\xF9g\x88E\xB3\xD0\xC2Уk\xF6a\xADE\x8A)]=\xE9jm\xBB\xAE\xD7rۂ\xD4\xFAӢ\xBE\x92\xBD\xA2 \x9A4=\x8B\xC73\xD8~\xB2\xAFd\xEEA\x83\xF1'j\x93iV\xAE\x925\xA3Zܘ\x98m\x9E3\MK[;\xABw\xD9\xC5\xFDGksO襏\xD2q\xE8\xAD\xE8a\x8C\x8E\x9F\x96\x8B\xAF\xD68'I+\xA5 \xB3On\xD7O\xB9\xAE\xF9Z\xE7\xD0'U\x8B\x96\xA2}\x92\xF6\\x9C'GGi\x84\x9F+פ\x93\xA1\xD5\xD1R5C=(\xB2\xCB\xDAٛ\xFE\xA6\xCF\xCD\xE4\xB9\xD5l׳\xB3 \xB4\x89\xB4\xB9m\x83i\xB3\x97\xA89\xB2\x8Dp\xE8\xD0\xC5\xC1\xB2\xE6rٵ\xF9'\xB6\xF9\xD8|\xEA\xD4\xE8\xA9-\xA6+\xDA\xD0\xDF/\xDF{\x99Q\xEDI\xDDM\xAB\xCA[\x95\x9F\xD6m۳\xA147Mk\xAC\xBF\xDB\xCEm\x9A\xF5<7Wd\xC5tͤv\xAEMF\xD3k\xD8\xDE\xD1:\xB4\x97\xB4\xADG\xD2\xEEa\xF5u\xF2\xAFb\x8B[`\x8F7\x96K\xD3ڃ\x8F\xF6G\x88\xE8p\xE9D͆d\xAF4~J\x8D\xF30r\xEC\xF5\xFF5\xAB\xB51zJ \xA5\xD0\xE6\xB6Cޔ^zף7\x964\xD3\xDE\xF5Y\xEE\xC82\xDD(j\xBB\xED\x8D\xF6\xE8+PVb\x86Y\xD4l0ʽ\xEC\xA4h+\x9D\xB9I\x9E$\xBD`\x8D\x89Ғh\xC6\x92t8\xB3ĉ&QI\x9F\xC1\xB5Y6ϙF5\xE5Z
+I\xA7\xAA\x8FJ^&@\xF2\x91\xB5\Cs\xF5Rv\xAD쒠\xBB\xD8vg֡\x8B%7my;\xBDjN\x81\x95\xAA\xAD\\xE5b\xAE\xB4\x8D$\x86\xFC\x95m\xA1\xA2ٸl\xBBjTm&\x99\xA3\xF9\xD2\xE6\x96L\x8B\xF6V\x92\x81\x91\xBB\xE6\xAB<V\x87I\xEF\xDA\xF9\xFD\x9A\xE2\xF6\xD4+\xEBh_i\xB4\x9E\x98\xAA!\xE2;3\xAAϭ\xFA\x9B\xCE\xC5@\x85h\xB4\x8F\xCBQg\xAA$\xFE\xA3NJ\xDCY\xE7B\xE2k\xEE\xA6Yϼ$9\xA2ɜ\xF5\x92ל+\xF4Z zy\xA9\xA6\xC2d\xE9\x8FR}\xB8\xA2\xC9t\x86FK\xC5ϟFǭ\\x8Ai\xAA^\x86dSN\xF6V\xD2u\xAE_F\xD5\xE8$\xF7\xAB03\xBFp\x94\xB5\xE0\xB3\xD0%\x92zl\xD70\xA3Z\xED\xA6\xB1F\xE9\xD0~-Qs\xA3\x95O\xDDG%\xC7\xFClF\xDB\xEA\xD2<U\x87\x9CǞC\xAA\xC3$b㔼:ؚ\xE3\x81\xF8R\x99\xF9\xD7L#O%\xD9%\xBAuXm*\xA47\xC6-}%u\x87\xAAu\x8F\xB6i48\xCAT\xE3\xA8H\x8D\xEB+\xAEK\xA2\xFB\x91&i\xD1~\xC52\xBAKm\xD4[( ?\xA4«d\x8Anp0,\x81\xE6QhH\xDD(\xEA?\xD5\xCE\xC3L\xBA-=9\xAE<\xF6\xCAvDj\x8B\xF7's\xAA\xF46R\xEBZ\xBFZj\xA3Oa\x959Uk/\x93\xA2I\xC4p\xB5\xD4\xC6=\x9AO\xDB\xDFz\x964C\xF4\xAB\xA56\x86\x8B\x9C\x9Cإ\xFA\xFC\x84|\xEEٮ\x96\xDA\xC8S%E\xB6\xDA,c\xEB\xB6}\xD0:7\xBE©\xCA5e\x8E\xA9\xAE\x96\xE2(~\xD2\xAE\x9C5\xB4\xD2e\x9A\x84\xF1\xCF\xF5 ,]\x97\xB6\xE3_\xF2m\xED\x9AF\xC2\xC1
+h\x8A\xA3\xA6?\x9A\xE9#%\xA3mS\xA6B\xB4IL\xE8G}\x97Y\x90\xF6藫\x80~0M\xBAR\x86WL6.\xFD\x91|Ŵ\xB1\x98='cF\x849\xDC\xE6\xB4%\xE9r}\xE9Ōkb\x83-yІ\xCFun\xF1\x93OM\x8D\x8A\xFC\x95q\x8E\xF8<\xD4\xE5\xE0k
+_\xD6\xF5\xF8f\xE3:\xE4e\x90l_\x93\xB1\xF5\xB1)\xCFq\x89\x8C/I\xFD\x83\xAFѲ&\xFE3\xFC\xF5\xA5Kn\xF3,\xDA\xD7b\xB0\xBDK\xB7q\xC9\xDB8\x85`<\xF8\xCDL\xCBZ\xF8\xCBǥPڼ\xBD\xEB\xFCYf}a\x98\xE3\xDA\xE3\xCCǕ\xECr\x92\xC8A\xC9z\xD6\xF7\xF46_\xC0.\x97$\x93&\x88\xDD,O\xEC\x8F4\xB7Uv\xBD^\x83+̖\xD1\xA1\x90]\xF3w\xB78d\x85\x81P\x9C\xE3\x92S\xDF\xD9\xD7#MeG'3\xFDe J\xC6\xF7)\xE4\xED\xEB\xB161ң\x8FK\xAE\xD7\xE4\x92M\xAB\xA7ٍY\x86rH.oe\x81\xA0\xB6\xFD@\xDBkR\xABUri\x8E\xCB\x99[\xD76r\xD0y֙\xB6\xF82\xBE\xF4:'\xA7DrA
+\xB5\x86\xE4\x8F\xD7V\xEFٟ\x9F\xECJQ\xC9d\xD2\xE3\xFC\xF3uӴ\xA2a&-cʂ\xF1\xDB\x8C\xB2\x8F\xB5\xB7\xF6\x93\xC99\xBBR5\xD9͵h\xC2 \xA5+\xB7\xCD\xCB\xB6\xFC\xB4\xF5$ٮ\xA1]\xCF'\xA4Q\x92\xB2\xA9.^\xB5\x95%O%\x{D8DE}SL\xC71\xCCϧ\xB9'A\x9E\x90\xB239V2j&\xF1\xB4pP9\xE9\xDC\x836q\x89}\xE6\xFA3\x98͆e-;\xE42\x9B
+\x9BW\xB6\x83벊\xB8ɜX\x92.\xCB4<R\xBD\xB8\x84\x95\x8EGeR\x98v]-\xE16\xA6\x81\x94\xD1\xF3Is\x82i\xEEG.I\xCD\xDC\xC2(c\xF3\xC9\x92?\x94Z\xF2\xAB\xEB\x8F\xF6\xB6o\xBA\x84풐\x8B\x92\xC1\xE6Tã\xD4{R\x96\xAA~)c\xFA29\x8A1\xA6\xDA \xD8j:Gڟ:\xBD>k_u.X\xC0Fԥ\x9A7v\x8D
+k\x83=\xFE\x8E\xACϪ\xC9m\xB2\xEF\h\x94\xBD5iSȈC\xDBMY\xCA'\xC5i\xDBc3k\xDBGd_-\xAC\xA7\xBC\x90ܻ[\xB3\x93S\xD6ϐ0\xCAfsj\xBA\xD8\xFBn\xC35L}\x89 |
|
From: <fer...@us...> - 2008-10-19 04:18:37
|
Revision: 6259
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6259&view=rev
Author: fer_perez
Date: 2008-10-19 04:18:34 +0000 (Sun, 19 Oct 2008)
Log Message:
-----------
More cleanups and updates to workbook
Modified Paths:
--------------
trunk/py4science/workbook/Makefile
Removed Paths:
-------------
trunk/py4science/workbook/fig/mpl_ratner.png
Modified: trunk/py4science/workbook/Makefile
===================================================================
--- trunk/py4science/workbook/Makefile 2008-10-19 03:51:56 UTC (rev 6258)
+++ trunk/py4science/workbook/Makefile 2008-10-19 04:18:34 UTC (rev 6259)
@@ -44,7 +44,7 @@
rm -f *~ *.aux *.log *.toc *.out *.bbl *.blg *.fmt
distclean: clean
- rm -f workbook_solutions.pdf workbook_skeletons.pdf
+ rm -f workbook_solutions.pdf workbook_skeletons.pdf
# Basic rules
empty :=
Deleted: trunk/py4science/workbook/fig/mpl_ratner.png
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fer...@us...> - 2008-10-19 03:52:03
|
Revision: 6258
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6258&view=rev
Author: fer_perez
Date: 2008-10-19 03:51:56 +0000 (Sun, 19 Oct 2008)
Log Message:
-----------
Major updates to workbook.
- Made the basemap figures smaller (they were too big and made the
compilation really slow).
- Changed the ratner figure from png to jpb (saved 90% in size)
- Removed all lyx files, we're now using pure latex.
- Added scripts for various useful tasks.
Modified Paths:
--------------
trunk/py4science/workbook/Makefile
trunk/py4science/workbook/basemap.tex
trunk/py4science/workbook/fig/basemap1.png
trunk/py4science/workbook/fig/basemap2.png
trunk/py4science/workbook/fig/basemap3.png
trunk/py4science/workbook/fig/basemap4.png
trunk/py4science/workbook/fig/basemap5.png
trunk/py4science/workbook/main.tex
trunk/py4science/workbook/wordfreqs.tex
Added Paths:
-----------
trunk/py4science/workbook/problems_soln/
trunk/py4science/workbook/problems_soln/basemap1.py
trunk/py4science/workbook/problems_soln/basemap2.py
trunk/py4science/workbook/problems_soln/basemap3.py
trunk/py4science/workbook/problems_soln/basemap4.py
trunk/py4science/workbook/problems_soln/basemap5.py
trunk/py4science/workbook/problems_soln/bessel.py
trunk/py4science/workbook/problems_soln/convolution_demo.py
trunk/py4science/workbook/problems_soln/fft_imdenoise.py
trunk/py4science/workbook/problems_soln/glass_dots1.py
trunk/py4science/workbook/problems_soln/lotka_volterra.py
trunk/py4science/workbook/problems_soln/noisy_sine.py
trunk/py4science/workbook/problems_soln/qsort.py
trunk/py4science/workbook/problems_soln/quad_newton.py
trunk/py4science/workbook/problems_soln/stats_descriptives.py
trunk/py4science/workbook/problems_soln/stats_distributions.py
trunk/py4science/workbook/problems_soln/stock_records.py
trunk/py4science/workbook/problems_soln/trapezoid.py
trunk/py4science/workbook/problems_soln/wallis_pi.py
trunk/py4science/workbook/problems_soln/wordfreqs.py
trunk/py4science/workbook/update_problems.py
Removed Paths:
-------------
trunk/py4science/workbook/intro.lyx
trunk/py4science/workbook/main.lyx
trunk/py4science/workbook/qsort.lyx
trunk/py4science/workbook/quad_newton.lyx
trunk/py4science/workbook/trapezoid.lyx
trunk/py4science/workbook/wallis_pi.lyx
trunk/py4science/workbook/wordfreqs.lyx
Modified: trunk/py4science/workbook/Makefile
===================================================================
--- trunk/py4science/workbook/Makefile 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/Makefile 2008-10-19 03:51:56 UTC (rev 6258)
@@ -9,25 +9,27 @@
SKEL_SRC = workbook_skeletons.aux workbook_skeletons.bbl \
workbook_skeletons.tex $(TEXFILES)
-SOL_SRC = $(subst _skeletons,_solved,$(SKEL_SRC))
+SOLN_SRC = $(subst _skeletons,_solutions,$(SKEL_SRC))
# programs
PDFTEX = pdflatex -file-line-error
FASTPDFTEX = pdflatex -file-line-error -draftmode -halt-on-error
# convenience shorthand for targets
-sol: workbook_solved.pdf
+sol: workbook_solutions.pdf
skel: workbook_skeletons.pdf
-all: sol skel
+all: soln skel
# actual targets
-workbook_solved.pdf: $(SOL_SRC)
+workbook_solutions.pdf: $(SOLN_SRC)
+ ./update_problems.py
rm -f problems
- ln -sf problems_solved problems
- $(PDFTEX) workbook_solved
- $(PDFTEX) workbook_solved
+ ln -sf problems_soln problems
+ $(PDFTEX) workbook_solutions
+ $(PDFTEX) workbook_solutions
workbook_skeletons.pdf: $(SKEL_SRC)
+ ./update_problems.py
rm -f problems
ln -sf problems_skel problems
$(PDFTEX) workbook_skeletons
@@ -35,14 +37,14 @@
workbook_skeletons.tex:
ln -sf main.tex workbook_skeletons.tex
-workbook_solved.tex:
- ln -sf main.tex workbook_solved.tex
+workbook_solutions.tex:
+ ln -sf main.tex workbook_solutions.tex
clean:
- rm -f *~ *.aux *.log *.toc *.out *.bbl *.blg
+ rm -f *~ *.aux *.log *.toc *.out *.bbl *.blg *.fmt
distclean: clean
- rm -f workbook_solved.pdf workbook_skeletons.pdf
+ rm -f workbook_solutions.pdf workbook_skeletons.pdf
# Basic rules
empty :=
Modified: trunk/py4science/workbook/basemap.tex
===================================================================
--- trunk/py4science/workbook/basemap.tex 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/basemap.tex 2008-10-19 03:51:56 UTC (rev 6258)
@@ -33,7 +33,7 @@
to Figure 1.
\begin{figure}[h]
-\includegraphics[scale=0.75]{fig/basemap1}
+\includegraphics[width=4in]{fig/basemap1}
\caption{A map created by specifying the latitudes and longitudes of the four
corners.}
@@ -64,7 +64,7 @@
This should produce something similar to Figure 2.
\begin{figure}[h]
-\includegraphics[scale=0.75]{fig/basemap3}
+\includegraphics[width=4in]{fig/basemap3}
\caption{Drawing the locations of two cities, and connecting them along a great
circle.}
@@ -84,7 +84,7 @@
Running this script should produce a plot that looks like Figure 3.
\begin{figure}[h]
-\includegraphics[scale=0.75]{fig/basemap4}
+\includegraphics[width=4in]{fig/basemap4}
\caption{Drawing labelled meridians and parallels on the map (a graticule grid).}
@@ -114,7 +114,7 @@
The resulting plot should look like Figure 4.
\begin{figure}[h]
-\includegraphics[scale=0.75]{fig/basemap5}
+\includegraphics[width=4in]{fig/basemap5}
\caption{Sea surface temperature on a global mollweide projection.}
Modified: trunk/py4science/workbook/fig/basemap1.png
===================================================================
(Binary files differ)
Modified: trunk/py4science/workbook/fig/basemap2.png
===================================================================
(Binary files differ)
Modified: trunk/py4science/workbook/fig/basemap3.png
===================================================================
(Binary files differ)
Modified: trunk/py4science/workbook/fig/basemap4.png
===================================================================
(Binary files differ)
Modified: trunk/py4science/workbook/fig/basemap5.png
===================================================================
(Binary files differ)
Deleted: trunk/py4science/workbook/intro.lyx
===================================================================
--- trunk/py4science/workbook/intro.lyx 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/intro.lyx 2008-10-19 03:51:56 UTC (rev 6258)
@@ -1,158 +0,0 @@
-#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass amsbook
-\begin_preamble
-\input{preamble.tex}
-\end_preamble
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize default
-\use_geometry true
-\use_amsmath 1
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\leftmargin 1.3in
-\topmargin 1in
-\rightmargin 1.3in
-\bottommargin 1in
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\tracking_changes false
-\output_changes false
-\end_header
-
-\begin_body
-
-\begin_layout Standard
-This document contains a set of small problems, drawn from many different
- fields, meant to illustrate commonly useful techniques for using Python
- in scientific computing.
-\end_layout
-
-\begin_layout Standard
-All problems are presented in a similar fashion: the task is explained including
- any necessary mathematical background and a `code skeleton' is provided
- that is meant to serve as a starting point for the solution of the exercise.
- In some cases, some example output of the expected solution, figures or
- additional hints may be provided as well.
-
-\end_layout
-
-\begin_layout Standard
-The accompanying source download for this workbook contains the complete
- solutions, which are not part of this document for the sake of brevity.
-\end_layout
-
-\begin_layout Standard
-For several examples, the provided skeleton contains pre-written tests which
- validate the correctness of the expected answers.
- When you have completed the exercise successfully, you should be able to
- run it from within IPython and see something like this (illustrated using
- a trapezoidal rule problem, whose solution is in the file
-\family typewriter
-trapezoid.py
-\family default
-):
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Standard
-
-
-\backslash
-begin{lstlisting}
-\end_layout
-
-\begin_layout Standard
-
-In [7]: run trapezoid.py
-\end_layout
-
-\begin_layout Standard
-
-....
-\end_layout
-
-\begin_layout Standard
-
-----------------------------------------------------------------------
-\end_layout
-
-\begin_layout Standard
-
-Ran 4 tests in 0.003s
-\end_layout
-
-\begin_layout Standard
-
-\end_layout
-
-\begin_layout Standard
-
-OK
-\end_layout
-
-\begin_layout Standard
-
-
-\backslash
-end{lstlisting}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-This message tells you that 4 automatic tests were successfully executed.
- The idea of including automatic tests in your code is a common one in modern
- software development, and Python includes in its standard library two modules
- for automatic testing, with slightly different functionality:
-\family typewriter
-unittest
-\family default
- and
-\family typewriter
-doctest
-\family default
-.
- These tests were written using the
-\family typewriter
-unittest
-\family default
- system, whose complete documentation can be found here:
-\begin_inset LatexCommand \htmlurl{http://docs.python.org/lib/module-unittest.html}
-
-\end_inset
-
-.
-
-\end_layout
-
-\begin_layout Standard
-Other exercises will illustrate the use of the
-\family typewriter
-doctest
-\family default
- system, since it provides complementary functionality.
-\end_layout
-
-\end_body
-\end_document
Deleted: trunk/py4science/workbook/main.lyx
===================================================================
--- trunk/py4science/workbook/main.lyx 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/main.lyx 2008-10-19 03:51:56 UTC (rev 6258)
@@ -1,166 +0,0 @@
-#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass amsbook
-\begin_preamble
-\input{preamble.tex}
-\end_preamble
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize letterpaper
-\use_geometry true
-\use_amsmath 2
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\leftmargin 1.3in
-\topmargin 1in
-\rightmargin 1.3in
-\bottommargin 1in
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle headings
-\tracking_changes false
-\output_changes true
-\end_header
-
-\begin_body
-
-\begin_layout Title
-\begin_inset ERT
-status collapsed
-
-\begin_layout Standard
-
-
-\backslash
-vspace{3cm}
-\end_layout
-
-\end_inset
-
-Practical Scientific Computing
-\newline
-in Python
-\newline
-A Workbook
-\end_layout
-
-\begin_layout Author
-\begin_inset ERT
-status collapsed
-
-\begin_layout Standard
-
-
-\backslash
-vspace{1cm}
-\end_layout
-
-\end_inset
-
-John D.
- Hunter
-\newline
-Fernando P\xE9rez
-\begin_inset ERT
-status collapsed
-
-\begin_layout Standard
-
-
-\backslash
-vspace{1cm}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset LatexCommand \tableofcontents{}
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Chapter
-Introduction
-\end_layout
-
-\begin_layout Standard
-\begin_inset Include \input{intro.lyx}
-preview false
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Chapter
-Simple non-numerical problems
-\end_layout
-
-\begin_layout Standard
-\begin_inset Include \input{qsort.lyx}
-preview false
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset Include \input{wordfreqs.lyx}
-preview false
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Chapter
-Elementary Numerics
-\end_layout
-
-\begin_layout Standard
-\begin_inset Include \input{wallis_pi.lyx}
-preview false
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset Include \input{trapezoid.lyx}
-preview false
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset Include \input{quad_newton.lyx}
-preview false
-
-\end_inset
-
-
-\end_layout
-
-\end_body
-\end_document
Modified: trunk/py4science/workbook/main.tex
===================================================================
--- trunk/py4science/workbook/main.tex 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/main.tex 2008-10-19 03:51:56 UTC (rev 6258)
@@ -112,6 +112,7 @@
\input{wallis_pi.tex}
\input{trapezoid.tex}
\input{quad_newton.tex}
+\input{bessel.tex}
\chapter{Linear algebra}
\input{intro_linalg.tex}
Added: trunk/py4science/workbook/problems_soln/basemap1.py
===================================================================
--- trunk/py4science/workbook/problems_soln/basemap1.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/basemap1.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/basemap1_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/basemap1.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/basemap2.py
===================================================================
--- trunk/py4science/workbook/problems_soln/basemap2.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/basemap2.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/basemap2_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/basemap2.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/basemap3.py
===================================================================
--- trunk/py4science/workbook/problems_soln/basemap3.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/basemap3.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/basemap3_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/basemap3.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/basemap4.py
===================================================================
--- trunk/py4science/workbook/problems_soln/basemap4.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/basemap4.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/basemap4_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/basemap4.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/basemap5.py
===================================================================
--- trunk/py4science/workbook/problems_soln/basemap5.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/basemap5.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/basemap5_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/basemap5.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/bessel.py
===================================================================
--- trunk/py4science/workbook/problems_soln/bessel.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/bessel.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/bessel_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/bessel.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/convolution_demo.py
===================================================================
--- trunk/py4science/workbook/problems_soln/convolution_demo.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/convolution_demo.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/convolution_demo_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/convolution_demo.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/fft_imdenoise.py
===================================================================
--- trunk/py4science/workbook/problems_soln/fft_imdenoise.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/fft_imdenoise.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/fft_imdenoise_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/fft_imdenoise.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/glass_dots1.py
===================================================================
--- trunk/py4science/workbook/problems_soln/glass_dots1.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/glass_dots1.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/glass_dots1_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/glass_dots1.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/lotka_volterra.py
===================================================================
--- trunk/py4science/workbook/problems_soln/lotka_volterra.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/lotka_volterra.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/lotka_volterra_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/lotka_volterra.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/noisy_sine.py
===================================================================
--- trunk/py4science/workbook/problems_soln/noisy_sine.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/noisy_sine.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/noisy_sine_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/noisy_sine.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/qsort.py
===================================================================
--- trunk/py4science/workbook/problems_soln/qsort.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/qsort.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/qsort_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/qsort.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/quad_newton.py
===================================================================
--- trunk/py4science/workbook/problems_soln/quad_newton.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/quad_newton.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/quad_newton_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/quad_newton.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/stats_descriptives.py
===================================================================
--- trunk/py4science/workbook/problems_soln/stats_descriptives.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/stats_descriptives.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/stats_descriptives_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/stats_descriptives.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/stats_distributions.py
===================================================================
--- trunk/py4science/workbook/problems_soln/stats_distributions.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/stats_distributions.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/stats_distributions_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/stats_distributions.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/stock_records.py
===================================================================
--- trunk/py4science/workbook/problems_soln/stock_records.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/stock_records.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/stock_records_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/stock_records.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/trapezoid.py
===================================================================
--- trunk/py4science/workbook/problems_soln/trapezoid.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/trapezoid.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/trapezoid_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/trapezoid.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/wallis_pi.py
===================================================================
--- trunk/py4science/workbook/problems_soln/wallis_pi.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/wallis_pi.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/wallis_pi_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/wallis_pi.py
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/py4science/workbook/problems_soln/wordfreqs.py
===================================================================
--- trunk/py4science/workbook/problems_soln/wordfreqs.py (rev 0)
+++ trunk/py4science/workbook/problems_soln/wordfreqs.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1 @@
+link ../../examples/soln/wordfreqs_soln.py
\ No newline at end of file
Property changes on: trunk/py4science/workbook/problems_soln/wordfreqs.py
___________________________________________________________________
Added: svn:special
+ *
Deleted: trunk/py4science/workbook/qsort.lyx
===================================================================
--- trunk/py4science/workbook/qsort.lyx 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/qsort.lyx 2008-10-19 03:51:56 UTC (rev 6258)
@@ -1,188 +0,0 @@
-#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass amsbook
-\begin_preamble
-\input{preamble.tex}
-\end_preamble
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize default
-\use_geometry true
-\use_amsmath 1
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\leftmargin 1.3in
-\topmargin 1in
-\rightmargin 1.3in
-\bottommargin 1in
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\tracking_changes false
-\output_changes false
-\end_header
-
-\begin_body
-
-\begin_layout Section
-Sorting quickly with QuickSort
-\end_layout
-
-\begin_layout Standard
-Quicksort is one of the best known, and probably the simplest, fast algorithm
- for sorting
-\begin_inset Formula $n$
-\end_inset
-
- items.
- It is fast in the sense that it requires on average
-\begin_inset Formula $\mathcal{O}(n\log n)$
-\end_inset
-
- comparisons instead of
-\begin_inset Formula $\mathcal{O}(n^{2})$
-\end_inset
-
-, although a naive implementation does have quadratic worst-case behavior.
-\end_layout
-
-\begin_layout Standard
-The algorithm uses a simple divide and conquer strategy, and its implementation
- is naturally recursive.
- Its basic steps are:
-\end_layout
-
-\begin_layout Enumerate
-Pick an element from the list, called the pivot
-\begin_inset Formula $p$
-\end_inset
-
- (any choice works).
-\end_layout
-
-\begin_layout Enumerate
-Select from the rest of the list those elements smaller and those greater
- than the pivot, and store them in separate lists
-\begin_inset Formula $S$
-\end_inset
-
- and
-\begin_inset Formula $G$
-\end_inset
-
-.
-\end_layout
-
-\begin_layout Enumerate
-Recursively apply the algorithm
-\family typewriter
-
-\family default
-to
-\begin_inset Formula $S$
-\end_inset
-
- and
-\begin_inset Formula $G$
-\end_inset
-
-.
- The final result can be written as
-\begin_inset Formula $\sigma(S)+[p]+\sigma(G)$
-\end_inset
-
-, where
-\begin_inset Formula $\sigma$
-\end_inset
-
- represents the sorting operation,
-\begin_inset Formula $+$
-\end_inset
-
- indicates list concatenation and
-\begin_inset Formula $[p]$
-\end_inset
-
- is the list containing the pivot as its single element.
-\end_layout
-
-\begin_layout Standard
-The listing\InsetSpace ~
-
-\begin_inset LatexCommand \ref{code:qsort_skel}
-
-\end_inset
-
- contains a skeleton with no implementation but with tests already written
- (in the form of
-\emph on
-unit tests
-\emph default
-, as described in the introduction).
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Standard
-
-
-\backslash
-lstinputlisting[label=code:qsort_skel,caption={IGNORED}]{skel/qsort_skel.py}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Subsection*
-Hints
-\end_layout
-
-\begin_layout Itemize
-Python has no particular syntactic requirements for implementing recursion,
- but it does have a maximum recursion depth.
- This value can be queried via the function
-\family typewriter
-sys.getrecursionlimit()
-\family default
-, and it can be changed with
-\family typewriter
-sys.setrecursionlimit(new_value)
-\family default
-.
-
-\end_layout
-
-\begin_layout Itemize
-Like in all recursive problems, don't forget to implement an exit condition!
-\end_layout
-
-\begin_layout Itemize
-If
-\family typewriter
-L
-\family default
- is a list, the call
-\family typewriter
-len(L)
-\family default
- provides its length.
-\end_layout
-
-\end_body
-\end_document
Deleted: trunk/py4science/workbook/quad_newton.lyx
===================================================================
--- trunk/py4science/workbook/quad_newton.lyx 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/quad_newton.lyx 2008-10-19 03:51:56 UTC (rev 6258)
@@ -1,151 +0,0 @@
-#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass amsbook
-\begin_preamble
-\input{preamble.tex}
-\end_preamble
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize default
-\use_geometry true
-\use_amsmath 1
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\leftmargin 1.3in
-\topmargin 1in
-\rightmargin 1.3in
-\bottommargin 1in
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\tracking_changes false
-\output_changes false
-\end_header
-
-\begin_body
-
-\begin_layout Section
-Newton's method
-\end_layout
-
-\begin_layout Standard
-Consider the problem of solving for
-\begin_inset Formula $t$
-\end_inset
-
- in
-\begin_inset Formula \begin{equation}
-\int_{o}^{t}f(s)ds=u\end{equation}
-
-\end_inset
-
- where
-\begin_inset Formula $f(s)$
-\end_inset
-
- is a monotonically increasing function of
-\begin_inset Formula $s$
-\end_inset
-
- and
-\begin_inset Formula $u>0$
-\end_inset
-
-.
-\end_layout
-
-\begin_layout Standard
-This problem can be simply solved if seen as a root finding question.
- Let
-\begin_inset Formula \begin{equation}
-g(t)=\int_{o}^{t}f(s)ds-u,\end{equation}
-
-\end_inset
-
-then we just need to find the root for
-\begin_inset Formula $g(t),$
-\end_inset
-
- which is guaranteed to be unique given the conditions above.
-
-\end_layout
-
-\begin_layout Standard
-The SciPy library includes an optimization package that contains a Newton-Raphso
-n solver called
-\family typewriter
-scipy.optimize.newton.
-
-\family default
- This solver can optionally take a known derivative for the function whose
- roots are being sought, and in this case the derivative is simply
-\begin_inset Formula \begin{equation}
-\frac{dg(t)}{dt}=f(t).\end{equation}
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-For this exercise, implement the solution for the test function
-\begin_inset Formula \[
-f(t)=t\sin^{2}(t),\]
-
-\end_inset
-
- using
-\begin_inset Formula \[
-u=\frac{1}{4}.\]
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-The listing\InsetSpace ~
-
-\begin_inset LatexCommand \ref{code:quad_newton_skel}
-
-\end_inset
-
- contains a skeleton that includes for comparison the correct numerical
- value.
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Standard
-
-
-\backslash
-lstinputlisting[label=code:quad_newton_skel,caption={IGNORED}]{skel/quad_newton_
-skel.py}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-
-\end_layout
-
-\end_body
-\end_document
Deleted: trunk/py4science/workbook/trapezoid.lyx
===================================================================
--- trunk/py4science/workbook/trapezoid.lyx 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/trapezoid.lyx 2008-10-19 03:51:56 UTC (rev 6258)
@@ -1,233 +0,0 @@
-#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass amsbook
-\begin_preamble
-\input{preamble.tex}
-\end_preamble
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize default
-\use_geometry true
-\use_amsmath 1
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\leftmargin 1.3in
-\topmargin 1in
-\rightmargin 1.3in
-\bottommargin 1in
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\tracking_changes false
-\output_changes false
-\end_header
-
-\begin_body
-
-\begin_layout Section
-Trapezoidal rule
-\end_layout
-
-\begin_layout Standard
-In this exercise, you are tasked with implementing the simple trapezoid
- rule formula for numerical integration.
- If we want to compute the definite integral
-\begin_inset Formula \begin{equation}
-\int_{a}^{b}f(x)dx\end{equation}
-
-\end_inset
-
-we can partition the integration interval
-\begin_inset Formula $[a,b]$
-\end_inset
-
- into smaller subintervals, and approximate the area under the curve for
- each subinterval by the area of the trapezoid created by linearly interpolating
- between the two function values at each end of the subinterval.
- This is graphically illustrated in Figure\InsetSpace ~
-
-\begin_inset LatexCommand \ref{fig:trapezoid}
-
-\end_inset
-
-, where the blue line represents the function
-\begin_inset Formula $f(x)$
-\end_inset
-
- and the red line represents the successive linear segments.
-\end_layout
-
-\begin_layout Standard
-The area under
-\begin_inset Formula $f(x)$
-\end_inset
-
- (the value of the definite integral) can thus be approximated as the sum
- of the areas of all these trapezoids.
- If we denote by
-\begin_inset Formula $x_{i}$
-\end_inset
-
- (
-\begin_inset Formula $i=0,\ldots,n,$
-\end_inset
-
- with
-\begin_inset Formula $x_{0}=a$
-\end_inset
-
- and
-\begin_inset Formula $x_{n}=b$
-\end_inset
-
-) the abscissas where the function is sampled, then
-\begin_inset Formula \begin{equation}
-\int_{a}^{b}f(x)dx\approx\frac{1}{2}\sum_{i=1}^{n}\left(x_{i}-x_{i-1}\right)\left(f(x_{i})+f(x_{i+1})\right).\label{eq:trapzf}\end{equation}
-
-\end_inset
-
-The common case of using equally spaced abscissas with spacing
-\begin_inset Formula $h=(b-a)/n$
-\end_inset
-
- reads simply
-\begin_inset Formula \begin{equation}
-\int_{a}^{b}f(x)dx\approx\frac{h}{2}\sum_{i=1}^{n}\left(f(x_{i})+f(x_{i+1})\right).\label{eq:trapzf2}\end{equation}
-
-\end_inset
-
-One frequently receives the function values already precomputed,
-\begin_inset Formula $y_{i}=f(x_{i}),$
-\end_inset
-
- so equation\InsetSpace ~
-(
-\begin_inset LatexCommand \ref{eq:trapzf}
-
-\end_inset
-
-) becomes
-\begin_inset Formula \begin{equation}
-\int_{a}^{b}f(x)dx\approx\frac{1}{2}\sum_{i=1}^{n}\left(x_{i}-x_{i-1}\right)\left(y_{i}+y_{i-1}\right).\label{eq:trapz}\end{equation}
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset Float figure
-wide false
-sideways false
-status open
-
-\begin_layout Standard
-\align center
-\begin_inset Graphics
- filename fig/Composite_trapezoidal_rule_illustration.png
- lyxscale 10
- width 3in
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Caption
-\begin_inset LatexCommand \label{fig:trapezoid}
-
-\end_inset
-
-Illustration of the composite trapezoidal rule with a non-uniform grid (Image
- credit: Wikipedia).
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-Listing\InsetSpace ~
-
-\begin_inset LatexCommand \ref{code:trapezoid_skel}
-
-\end_inset
-
- contains a skeleton for this problem, written in the form of two incomplete
- functions and a set of automatic tests (in the form of
-\emph on
-unit tests
-\emph default
-, as described in the introduction).
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Standard
-
-
-\backslash
-lstinputlisting[label=code:trapezoid_skel,caption={IGNORED}]{skel/trapezoid_skel.
-py}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-In this exercise, you'll need to write two functions,
-\family typewriter
-trapz
-\family default
- and
-\family typewriter
-trapzf
-\family default
-.
-
-\family typewriter
-trapz
-\family default
- applies the trapezoid formula to pre-computed values, implementing equation\InsetSpace ~
-(
-\begin_inset LatexCommand \ref{eq:trapz}
-
-\end_inset
-
-), while
-\family typewriter
-trapzf
-\family default
- takes a function
-\begin_inset Formula $f$
-\end_inset
-
- as input, as well as the total number of samples to evaluate, and computes
- eq.\InsetSpace ~
-(
-\begin_inset LatexCommand \ref{eq:trapzf2}
-
-\end_inset
-
-).
-\end_layout
-
-\end_body
-\end_document
Added: trunk/py4science/workbook/update_problems.py
===================================================================
--- trunk/py4science/workbook/update_problems.py (rev 0)
+++ trunk/py4science/workbook/update_problems.py 2008-10-19 03:51:56 UTC (rev 6258)
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+"""Update the problems (skeletons and solutions) relative to their source.
+
+"""
+import os
+
+from glob import glob
+from os import system as sh
+
+from IPython.genutils import target_outdated
+
+# Constants
+SRC_DIR = '../examples'
+UPDATE = './mkskel.py'
+
+
+if __name__ == '__main__':
+
+ problems = [f for f in os.listdir('problems') if f.endswith('.py')]
+
+ os.chdir(SRC_DIR)
+ to_update = []
+ for f in problems:
+ skel = os.path.join('skel',f.replace('.py','_skel.py'))
+ soln = os.path.join('soln',f.replace('.py','_soln.py'))
+ src = [f]
+ if target_outdated(skel,src) or target_outdated(soln,src):
+ to_update.append(f)
+
+ if to_update:
+ targets = ' '.join(to_update)
+ print 'Updating the following problems:\n',targets
+ sh('%s %s' % (UPDATE,targets))
+ else:
+ print 'All targets up to date, nothing to do.'
Property changes on: trunk/py4science/workbook/update_problems.py
___________________________________________________________________
Added: svn:executable
+ *
Deleted: trunk/py4science/workbook/wallis_pi.lyx
===================================================================
--- trunk/py4science/workbook/wallis_pi.lyx 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/wallis_pi.lyx 2008-10-19 03:51:56 UTC (rev 6258)
@@ -1,137 +0,0 @@
-#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass amsbook
-\begin_preamble
-\input{preamble.tex}
-\end_preamble
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize default
-\use_geometry true
-\use_amsmath 1
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\leftmargin 1.3in
-\topmargin 1in
-\rightmargin 1.3in
-\bottommargin 1in
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\tracking_changes false
-\output_changes false
-\end_header
-
-\begin_body
-
-\begin_layout Section
-Wallis' slow road to
-\begin_inset Formula $\pi$
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-Wallis' formula is an infinite product that converges (slowly) to
-\begin_inset Formula $\pi$
-\end_inset
-
-:
-\begin_inset Formula \begin{equation}
-\pi=\prod_{i=1}^{\infty}\frac{4i^{2}}{4i^{2}-1}.\end{equation}
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-The listing\InsetSpace ~
-
-\begin_inset LatexCommand \ref{code:wallis_pi_skel}
-
-\end_inset
-
- contains a skeleton with no implementation but with some plotting commands
- already inserted, so that you can visualize the convergence rate of this
- formula as more terms are kept.
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Standard
-
-
-\backslash
-lstinputlisting[label=code:wallis_pi_skel,caption={IGNORED}]{skel/wallis_pi_skel.
-py}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-After running the script successfully, you should obtain a plot similar
- to Figure\InsetSpace ~
-
-\begin_inset LatexCommand \ref{fig:wallis_pi}
-
-\end_inset
-
-.
-\end_layout
-
-\begin_layout Standard
-\align center
-\begin_inset Float figure
-wide false
-sideways false
-status open
-
-\begin_layout Standard
-\align center
-\begin_inset Graphics
- filename fig/wallis_pi_convergence.eps
- width 4in
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Caption
-\begin_inset LatexCommand \label{fig:wallis_pi}
-
-\end_inset
-
-Convergence rate for Wallis' infinite product approximation to
-\begin_inset Formula $\pi.$
-\end_inset
-
-
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\end_body
-\end_document
Deleted: trunk/py4science/workbook/wordfreqs.lyx
===================================================================
--- trunk/py4science/workbook/wordfreqs.lyx 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/wordfreqs.lyx 2008-10-19 03:51:56 UTC (rev 6258)
@@ -1,245 +0,0 @@
-#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass amsbook
-\begin_preamble
-\input{preamble.tex}
-\end_preamble
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize default
-\use_geometry true
-\use_amsmath 1
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\leftmargin 1.3in
-\topmargin 1in
-\rightmargin 1.3in
-\bottommargin 1in
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\tracking_changes false
-\output_changes false
-\end_header
-
-\begin_body
-
-\begin_layout Section
-Dictionaries for counting words
-\end_layout
-
-\begin_layout Standard
-A common task in text processing is to produce a count of word frequencies.
- While NumPy has a builtin histogram function for doing numerical histograms,
- it won't work out of the box for couting discrete items, since it is a
- binning histogram for a range of real values.
-\end_layout
-
-\begin_layout Standard
-But the Python language provides very powerful string manipulation capabilities,
- as well as a very flexible and efficiently implemented builtin data type,
- the
-\emph on
-dictionary
-\emph default
-, that makes this task a very simple one.
-\end_layout
-
-\begin_layout Standard
-In this problem, you will need to count the frequencies of all the words
- contained in a compressed text file supplied as input.
-
-\end_layout
-
-\begin_layout Standard
-The listing\InsetSpace ~
-
-\begin_inset LatexCommand \ref{code:wordfreqs_skel}
-
-\end_inset
-
- contains a skeleton for this problem, with
-\family typewriter
-XXX
-\family default
- marking various places that are incomplete.
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Standard
-
-
-\backslash
-lstinputlisting[label=code:wordfreqs_skel,caption={IGNORED}]{skel/wordfreqs_skel.
-py}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Subsection*
-Hints
-\end_layout
-
-\begin_layout Itemize
-The
-\family typewriter
-print_vk
-\family default
-function is already provided for you as a simple way to summarize your results.
-\end_layout
-
-\begin_layout Itemize
-You will need to read the compressed file
-\family typewriter
-HISTORY.gz
-\family default
-.
- Python has facilities to do this without having to manually uncompress
- it.
-\end_layout
-
-\begin_layout Itemize
-Consider `words' simply the result of splitting the input text into a list,
- using any form of whitespace as a separator.
- This is obviously a very na\xEFve definition of `word', but it shall suffice
- for the purposes of this exercise.
-\end_layout
-
-\begin_layout Itemize
-Python strings have a
-\family typewriter
-.split()
-\family default
- method that allows for very flexible splitting.
- You can easily get more details on it in IPython:
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Standard
-
-
-\backslash
-begin{lstlisting}
-\end_layout
-
-\begin_layout Standard
-
-In [2]: a = 'somestring'
-\end_layout
-
-\begin_layout Standard
-
-\end_layout
-
-\begin_layout Standard
-
-In [3]: a.split?
-\end_layout
-
-\begin_layout Standard
-
-Type: builtin_function_or_method
-\end_layout
-
-\begin_layout Standard
-
-Base Class: <type 'builtin_function_or_method'>
-\end_layout
-
-\begin_layout Standard
-
-Namespace: Interactive
-\end_layout
-
-\begin_layout Standard
-
-Docstring:
-\end_layout
-
-\begin_layout Standard
-
- S.split([sep [,maxsplit]]) -> list of strings
-\end_layout
-
-\begin_layout Standard
-
-\end_layout
-
-\begin_layout Standard
-
- Return a list of the words in the string S, using sep as the
-\end_layout
-
-\begin_layout Standard
-
- delimiter string.
- If maxsplit is given, at most maxsplit
-\end_layout
-
-\begin_layout Standard
-
- splits are done.
- If sep is not specified or is None, any
-\end_layout
-
-\begin_layout Standard
-
- whitespace string is a separator.
-\end_layout
-
-\begin_layout Standard
-
-
-\backslash
-end{lstlisting}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-The complete set of methods of Python strings can be viewed by hitting the
- TAB key in IPython after typing `
-\family typewriter
-a.
-\family default
-', and each of them can be similarly queried with the `
-\family typewriter
-?
-\family default
-' operator as above.
- For more details on Python strings and their companion sequence types,
- see
-\begin_inset LatexCommand \htmlurl{http://docs.python.org/lib/typesseq.html}
-
-\end_inset
-
-.
-\end_layout
-
-\end_body
-\end_document
Modified: trunk/py4science/workbook/wordfreqs.tex
===================================================================
--- trunk/py4science/workbook/wordfreqs.tex 2008-10-19 03:49:27 UTC (rev 6257)
+++ trunk/py4science/workbook/wordfreqs.tex 2008-10-19 03:51:56 UTC (rev 6258)
@@ -54,4 +54,5 @@
the TAB key in IPython after typing `\texttt{a.}', and each of them
can be similarly queried with the `\texttt{?}' operator as above.
For more details on Python strings and their companion sequence types,
-see \url{http://docs.python.org/lib/typesseq.html}.
+see
+\url{http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-buffer-xrange}.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fer...@us...> - 2008-10-19 03:49:32
|
Revision: 6257
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6257&view=rev
Author: fer_perez
Date: 2008-10-19 03:49:27 +0000 (Sun, 19 Oct 2008)
Log Message:
-----------
New script to enable new problems.
Added Paths:
-----------
trunk/py4science/workbook/add_problem
Added: trunk/py4science/workbook/add_problem
===================================================================
--- trunk/py4science/workbook/add_problem (rev 0)
+++ trunk/py4science/workbook/add_problem 2008-10-19 03:49:27 UTC (rev 6257)
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Add a new problem to the workbook. This script simply creates the two
+# necessary symlinks.
+#
+# Usage:
+#
+# add_problem name
+#
+# NOTE: name should NOT contain the .py extension or path, just the basename of
+# the script. For example:
+#
+# add_problem qsort
+#
+# assumes there is a qsort.py problem in the examples directory, with
+# qsort_skel.py in the skel/ subdir and a qsort_soln.py in the soln/ subdir.
+
+prob=$1
+
+startdir=$(pwd)
+
+cd problems_skel
+ln -s ../../examples/skel/${prob}_skel.py ${prob}.py
+
+cd $startdir
+
+cd problems_soln
+ln -s ../../examples/soln/${prob}_soln.py ${prob}.py
Property changes on: trunk/py4science/workbook/add_problem
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-10-18 19:51:36
|
Revision: 6256
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6256&view=rev
Author: efiring
Date: 2008-10-18 19:51:22 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Clip floating point values before conversion to integer; thanks to Tony Yu.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2008-10-18 17:47:28 UTC (rev 6255)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2008-10-18 19:51:22 UTC (rev 6256)
@@ -455,7 +455,10 @@
mask_bad = ma.getmask(xma)
if xa.dtype.char in np.typecodes['Float']:
np.putmask(xa, xa==1.0, 0.9999999) #Treat 1.0 as slightly less than 1.
- xa = (xa * self.N).astype(int)
+ # The following clip is fast, and prevents possible
+ # conversion of large positive values to negative integers.
+ np.clip(xa * self.N, -1, self.N, out=xa)
+ xa = xa.astype(int)
# Set the over-range indices before the under-range;
# otherwise the under-range values get converted to over-range.
np.putmask(xa, xa>self.N-1, self._i_over)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-10-18 17:47:31
|
Revision: 6255
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6255&view=rev
Author: jswhit
Date: 2008-10-18 17:47:28 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
back out change
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2008-10-18 01:15:15 UTC (rev 6254)
+++ trunk/toolkits/basemap/Changelog 2008-10-18 17:47:28 UTC (rev 6255)
@@ -5,7 +5,6 @@
* fix bugs in warpimage and bluemarble methods for several projections.
* bugfix patch for rotate_vector from David Huard. David
also contributed the beginnings of a test suite.
- * _geoslib.so now installed in mpl_toolkits.basemap.
* make sure scatter method sets pyplot color mappable.
* added cubed_sphere example.
* updated NetCDFFile to use pupynere 1.0.2 (now can write as well
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-10-18 01:15:22
|
Revision: 6254
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6254&view=rev
Author: jswhit
Date: 2008-10-18 01:15:15 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
move tests to separate file.
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Added Paths:
-----------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/test.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-10-17 20:24:50 UTC (rev 6253)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-10-18 01:15:15 UTC (rev 6254)
@@ -3871,57 +3871,3 @@
"""
cdftime = netcdftime.utime(units,calendar=calendar)
return cdftime.date2num(dates)
-
-
-
-# beginnings of a test suite.
-
-from numpy.testing import NumpyTestCase,assert_almost_equal
-class TestRotateVector(NumpyTestCase):
- def make_array(self):
- lat = np.array([0, 45, 75, 90])
- lon = np.array([0,90,180,270])
- u = np.ones((len(lat), len(lon)))
- v = np.zeros((len(lat), len(lon)))
- return u,v,lat,lon
-
- def test_cylindrical(self):
- # Cylindrical case
- B = Basemap()
- u,v,lat,lon=self.make_array()
- ru, rv = B.rotate_vector(u,v, lon, lat)
-
- # Check that the vectors are identical.
- assert_almost_equal(ru, u)
- assert_almost_equal(rv, v)
-
- def test_nan(self):
- B = Basemap()
- u,v,lat,lon=self.make_array()
- # Set one element to 0, so that the vector magnitude is 0.
- u[1,1] = 0.
- ru, rv = B.rotate_vector(u,v, lon, lat)
- assert not np.isnan(ru).any()
- assert_almost_equal(u, ru)
- assert_almost_equal(v, rv)
-
- def test_npstere(self):
- # NP Stereographic case
- B=Basemap(projection='npstere', boundinglat=50., lon_0=0.)
- u,v,lat,lon=self.make_array()
- v = np.ones((len(lat), len(lon)))
-
- ru, rv = B.rotate_vector(u,v, lon, lat)
-
- assert_almost_equal(ru[2, :],[1,-1,-1,1], 6)
- assert_almost_equal(rv[2, :],[1,1,-1,-1], 6)
-
-def test():
- """
- Run some tests.
- """
- import unittest
- suite = unittest.makeSuite(TestRotateVector,'test')
- runner = unittest.TextTestRunner()
- runner.run(suite)
-
Added: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/test.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/test.py (rev 0)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/test.py 2008-10-18 01:15:15 UTC (rev 6254)
@@ -0,0 +1,56 @@
+from mpl_toolkits.basemap import Basemap
+import numpy as np
+
+# beginnings of a test suite.
+
+from numpy.testing import NumpyTestCase,assert_almost_equal
+class TestRotateVector(NumpyTestCase):
+ def make_array(self):
+ lat = np.array([0, 45, 75, 90])
+ lon = np.array([0,90,180,270])
+ u = np.ones((len(lat), len(lon)))
+ v = np.zeros((len(lat), len(lon)))
+ return u,v,lat,lon
+
+ def test_cylindrical(self):
+ # Cylindrical case
+ B = Basemap()
+ u,v,lat,lon=self.make_array()
+ ru, rv = B.rotate_vector(u,v, lon, lat)
+
+ # Check that the vectors are identical.
+ assert_almost_equal(ru, u)
+ assert_almost_equal(rv, v)
+
+ def test_nan(self):
+ B = Basemap()
+ u,v,lat,lon=self.make_array()
+ # Set one element to 0, so that the vector magnitude is 0.
+ u[1,1] = 0.
+ ru, rv = B.rotate_vector(u,v, lon, lat)
+ assert not np.isnan(ru).any()
+ assert_almost_equal(u, ru)
+ assert_almost_equal(v, rv)
+
+ def test_npstere(self):
+ # NP Stereographic case
+ B=Basemap(projection='npstere', boundinglat=50., lon_0=0.)
+ u,v,lat,lon=self.make_array()
+ v = np.ones((len(lat), len(lon)))
+
+ ru, rv = B.rotate_vector(u,v, lon, lat)
+
+ assert_almost_equal(ru[2, :],[1,-1,-1,1], 6)
+ assert_almost_equal(rv[2, :],[1,1,-1,-1], 6)
+
+def test():
+ """
+ Run some tests.
+ """
+ import unittest
+ suite = unittest.makeSuite(TestRotateVector,'test')
+ runner = unittest.TextTestRunner()
+ runner.run(suite)
+
+if __name__ == '__main__':
+ test()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 20:24:57
|
Revision: 6253
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6253&view=rev
Author: jdh2358
Date: 2008-10-17 20:24:50 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
added plotting template docs
Added Paths:
-----------
trunk/matplotlib/doc/users/plotting.rst
Added: trunk/matplotlib/doc/users/plotting.rst
===================================================================
--- trunk/matplotlib/doc/users/plotting.rst (rev 0)
+++ trunk/matplotlib/doc/users/plotting.rst 2008-10-17 20:24:50 UTC (rev 6253)
@@ -0,0 +1,151 @@
+.. _plotting-guide:
+
+***************
+Plotting guide
+***************
+
+An in-depth, tutorial style guide to the matplotlib plotting
+functions, which explains the most important keyword arguments with
+examples and figures.
+
+.. _image-plots:
+
+Images
+======
+:func:`~matplotlib.pyplot.imshow`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+
+.. _colormaps-plots:
+
+Colormaps
+==========
+
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _colorbars-plots:
+
+Colorbars
+==========
+
+:func:`~matplotlib.pyplot.colorbar`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _contour-plots:
+
+Contouring
+==========
+
+:func:`~matplotlib.pyplot.contour`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _scatter-plots:
+
+Scatter plots
+==============
+
+:func:`~matplotlib.pyplot.scatter`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _log-plots:
+
+Log plots
+==============
+
+:func:`~matplotlib.pyplot.semilogx`, :func:`~matplotlib.pyplot.semilogy` and :func:`~matplotlib.pyplot.loglog`
+
+.. _polar-plots:
+
+Polar plots
+==============
+
+:func:`~matplotlib.pyplot.polar`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _filled-plots:
+
+Filled plots
+==============
+
+:func:`~matplotlib.pyplot.fill` and :mod:`~matplotlib.patches`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _bar-plots:
+
+Bar charts, histograms and errorbars
+======================================
+
+:func:`~matplotlib.pyplot.bar`, :func:`~matplotlib.pyplot.barh`,
+:func:`~matplotlib.pyplot.errorbar` and
+:func:`~matplotlib.pyplot.hist`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _time-series-plots:
+
+Timeseries plots
+==========================
+
+:func:`~matplotlib.pyplot.acorr`, :func:`~matplotlib.pyplot.xcorr`, :func:`~matplotlib.pyplot.psd`, :func:`~matplotlib.pyplot.csd`,
+:func:`~matplotlib.pyplot.cohere`, :func:`~matplotlib.pyplot.specgram`
+and the windowing and detrending functions in :mod:`matplotlib.mlab`.
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _sparsity-plots:
+
+Sparsity plots
+==========================
+
+:func:`~matplotlib.pyplot.spy`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _boxplots-plots:
+
+Boxplots
+==========================
+
+:func:`~matplotlib.pyplot.boxplot`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _date-plots:
+
+Working with dates
+==========================
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _masked-data-plots:
+
+Working with masked/missing data
+==================================
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _collections-plots:
+
+Working with collections
+==================================
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _legend-plots:
+
+Creating figure and axes legends
+==================================
+:func:`~matplotlib.pyplot.legend` and :func:`~matplotlib.pyplot.figlegend`
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 20:24:10
|
Revision: 6252
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6252&view=rev
Author: jdh2358
Date: 2008-10-17 20:24:06 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
added mlab api docs
Modified Paths:
--------------
trunk/matplotlib/doc/api/index.rst
trunk/matplotlib/doc/users/index.rst
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/mlab.py
Added Paths:
-----------
trunk/matplotlib/doc/api/mlab_api.rst
Modified: trunk/matplotlib/doc/api/index.rst
===================================================================
--- trunk/matplotlib/doc/api/index.rst 2008-10-17 19:32:16 UTC (rev 6251)
+++ trunk/matplotlib/doc/api/index.rst 2008-10-17 20:24:06 UTC (rev 6252)
@@ -23,6 +23,7 @@
colorbar_api.rst
colors_api.rst
nxutils_api.rst
+ mlab_api.rst
path_api.rst
pyplot_api.rst
index_backend_api.rst
Added: trunk/matplotlib/doc/api/mlab_api.rst
===================================================================
--- trunk/matplotlib/doc/api/mlab_api.rst (rev 0)
+++ trunk/matplotlib/doc/api/mlab_api.rst 2008-10-17 20:24:06 UTC (rev 6252)
@@ -0,0 +1,12 @@
+****************
+matplotlib mlab
+****************
+
+
+:mod:`matplotlib.mlab`
+=======================
+
+.. automodule:: matplotlib.mlab
+ :members:
+ :undoc-members:
+ :show-inheritance:
Modified: trunk/matplotlib/doc/users/index.rst
===================================================================
--- trunk/matplotlib/doc/users/index.rst 2008-10-17 19:32:16 UTC (rev 6251)
+++ trunk/matplotlib/doc/users/index.rst 2008-10-17 20:24:06 UTC (rev 6252)
@@ -21,6 +21,7 @@
index_text.rst
artists.rst
event_handling.rst
+ plotting.rst
toolkits.rst
screenshots.rst
license.rst
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-10-17 19:32:16 UTC (rev 6251)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-10-17 20:24:06 UTC (rev 6252)
@@ -3387,7 +3387,7 @@
maxlags=None, **kwargs)
Plot the autocorrelation of *x*. If *normed* = *True*,
- normalize the data but the autocorrelation at 0-th lag. *x* is
+ normalize the data by the autocorrelation at 0-th lag. *x* is
detrended by the *detrend* callable (default no normalization).
Data are plotted as ``plot(lags, c, **kwargs)``
@@ -4370,7 +4370,7 @@
**Example:**
- .. plot:: mpl_examples/pyplot_examples/errorbar_demo.py
+ .. plot:: mpl_examples/pylab_examples/errorbar_demo.py
"""
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-17 19:32:16 UTC (rev 6251)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-17 20:24:06 UTC (rev 6252)
@@ -3,66 +3,94 @@
Numerical python functions written for compatability with matlab(TM)
commands with the same names.
- Matlab(TM) compatible functions:
+Matlab(TM) compatible functions
+-------------------------------
- * cohere - Coherence (normalized cross spectral density)
+:func:`cohere`
+ Coherence (normalized cross spectral density)
- * csd - Cross spectral density uing Welch's average periodogram
+:func:`csd`
+ Cross spectral density uing Welch's average periodogram
- * detrend -- Remove the mean or best fit line from an array
+:func:`detrend`
+ Remove the mean or best fit line from an array
- * find - Return the indices where some condition is true;
- numpy.nonzero is similar but more general.
+:func:`find`
+ Return the indices where some condition is true;
+ numpy.nonzero is similar but more general.
- * griddata - interpolate irregularly distributed data to a
- regular grid.
+:func:`griddata`
+ interpolate irregularly distributed data to a
+ regular grid.
- * prctile - find the percentiles of a sequence
+:func:`prctile`
+ find the percentiles of a sequence
- * prepca - Principal Component Analysis
+:func:`prepca`
+ Principal Component Analysis
- * psd - Power spectral density uing Welch's average periodogram
+:func:`psd`
+ Power spectral density uing Welch's average periodogram
- * rk4 - A 4th order runge kutta integrator for 1D or ND systems
+:func:`rk4`
+ A 4th order runge kutta integrator for 1D or ND systems
- The following are deprecated; please import directly from numpy
- (with care--function signatures may differ):
+Miscellaneous functions
+-------------------------
- * conv - convolution (numpy.convolve)
- * corrcoef - The matrix of correlation coefficients
- * hist -- Histogram (numpy.histogram)
- * linspace -- Linear spaced array from min to max
- * meshgrid
- * polyfit - least squares best polynomial fit of x to y
- * polyval - evaluate a vector for a vector of polynomial coeffs
- * trapz - trapeziodal integration (trapz(x,y) -> numpy.trapz(y,x))
- * vander - the Vandermonde matrix
+Functions that don't exist in matlab(TM), but are useful anyway:
- Functions that don't exist in matlab(TM), but are useful anyway:
+:meth:`cohere_pairs`
+ Coherence over all pairs. This is not a matlab function, but we
+ compute coherence a lot in my lab, and we compute it for a lot of
+ pairs. This function is optimized to do this efficiently by
+ caching the direct FFTs.
- * cohere_pairs - Coherence over all pairs. This is not a matlab
- function, but we compute coherence a lot in my lab, and we
- compute it for a lot of pairs. This function is optimized to do
- this efficiently by caching the direct FFTs.
+:meth:`rk4`
+ A 4th order Runge-Kutta ODE integrator in case you ever find
+ yourself stranded without scipy (and the far superior
+ scipy.integrate tools)
-= record array helper functions =
- * rec2txt : pretty print a record array
- * rec2csv : store record array in CSV file
- * csv2rec : import record array from CSV file with type inspection
- * rec_append_fields: adds field(s)/array(s) to record array
- * rec_drop_fields : drop fields from record array
- * rec_join : join two record arrays on sequence of fields
- * rec_groupby : summarize data by groups (similar to SQL GROUP BY)
- * rec_summarize : helper code to filter rec array fields into new fields
+record array helper functions
+-------------------------------
+A collection of helper methods for numpyrecord arrays
+
+.. _htmlonly::
+
+ See :ref:`misc-examples-index`
+
+:meth:`rec2txt`
+ pretty print a record array
+
+:meth:`rec2csv`
+ store record array in CSV file
+
+:meth:`csv2rec`
+ import record array from CSV file with type inspection
+
+:meth:`rec_append_fields`
+ adds field(s)/array(s) to record array
+
+:meth:`rec_drop_fields`
+ drop fields from record array
+
+:meth:`rec_join`
+ join two record arrays on sequence of fields
+
+:meth:`rec_groupby`
+ summarize data by groups (similar to SQL GROUP BY)
+
+:meth:`rec_summarize`
+ helper code to filter rec array fields into new fields
+
For the rec viewer functions(e rec2csv), there are a bunch of Format
objects you can pass into the functions that will do things like color
negative values red, set percent formatting and scaling, etc.
+Example usage::
-Example usage:
-
r = csv2rec('somefile.csv', checkrows=0)
formatd = dict(
@@ -82,6 +110,40 @@
win.show_all()
gtk.main()
+
+Deprecated functions
+---------------------
+
+The following are deprecated; please import directly from numpy (with
+care--function signatures may differ):
+
+:meth:`conv`
+ convolution (numpy.convolve)
+
+:meth:`corrcoef`
+ The matrix of correlation coefficients
+
+:meth:`hist`
+ Histogram (numpy.histogram)
+
+:meth:`linspace`
+ Linear spaced array from min to max
+
+:meth:`meshgrid`
+ Make a 2D grid from 2 1 arrays (numpy.meshgrid)
+
+:meth:`polyfit`
+ least squares best polynomial fit of x to y (numpy.polyfit)
+
+:meth:`polyval`
+ evaluate a vector for a vector of polynomial coeffs (numpy.polyval)
+
+:meth:`trapz`
+ trapeziodal integration (trapz(x,y) -> numpy.trapz(y,x))
+
+:meth:`vander`
+ the Vandermonde matrix (numpy.vander)
+
"""
from __future__ import division
@@ -185,20 +247,23 @@
to calculate the Fourier frequencies, freqs, in cycles per time
unit.
- -- NFFT must be even; a power 2 is most efficient.
- -- detrend is a functions, unlike in matlab where it is a vector.
- -- window can be a function or a vector of length NFFT. To create window
- vectors see numpy.blackman, numpy.hamming, numpy.bartlett,
- scipy.signal, scipy.signal.get_window etc.
- -- if length x < NFFT, it will be zero padded to NFFT
+ *NFFT*
+ The length of the FFT window. Must be even; a power 2 is most efficient.
+ *detrend*
+ is a function, unlike in matlab where it is a vector.
- Returns the tuple Pxx, freqs
+ *window*
+ can be a function or a vector of length NFFT. To create window
+ vectors see numpy.blackman, numpy.hamming, numpy.bartlett,
+ scipy.signal, scipy.signal.get_window etc.
- Refs:
- Bendat & Piersol -- Random Data: Analysis and Measurement
- Procedures, John Wiley & Sons (1986)
+ If length x < NFFT, it will be zero padded to NFFT
+ Returns the tuple (*Pxx*, *freqs*)
+
+ Refs: Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
+
"""
# I think we could remove this condition without hurting anything.
if NFFT % 2:
@@ -409,7 +474,7 @@
window=window_hanning, noverlap=0):
"""
The coherence between x and y. Coherence is the normalized
- cross spectral density
+ cross spectral density:
.. math::
@@ -470,7 +535,7 @@
Method: if X is a the Vandermonde Matrix computed from x (see
- http://mathworld.wolfram.com/VandermondeMatrix.html), then the
+ `vandermonds <http://mathworld.wolfram.com/VandermondeMatrix.html>`_), then the
polynomial least squares solution is given by the 'p' in
X*p = y
@@ -487,7 +552,7 @@
numpy.linalg.lstsq.
For more info, see
- http://mathworld.wolfram.com/LeastSquaresFittingPolynomial.html,
+ `least squares fitting <http://mathworld.wolfram.com/LeastSquaresFittingPolynomial.html>`_,
but note that the k's and n's in the superscripts and subscripts
on that page. The linear algebra is correct, however.
@@ -898,14 +963,21 @@
def rk4(derivs, y0, t):
"""
- Integrate 1D or ND system of ODEs from initial state y0 at sample
- times t. derivs returns the derivative of the system and has the
- signature
+ Integrate 1D or ND system of ODEs using 4-th order Runge-Kutta. This is a toy implementation which may be useful if you find yourself stranded on a system w/o scipy. Otherwise use ``scipy.integrate``
- dy = derivs(yi, ti)
+ *y0*
+ initial state vector
+
+ *t*
+ sample times
- Example 1 :
+ *derivs*
+ returns the derivative of the system and has the
+ signature ``dy = derivs(yi, ti)``
+
+ Example 1 ::
+
## 2D system
def derivs6(x,t):
@@ -917,7 +989,7 @@
y0 = (1,2)
yout = rk4(derivs6, y0, t)
- Example 2:
+ Example 2::
## 1D system
alpha = 2
@@ -963,7 +1035,7 @@
"""
Bivariate gaussan distribution for equal shape X, Y
- http://mathworld.wolfram.com/BivariateNormalDistribution.html
+ See `bivariate normal <http://mathworld.wolfram.com/BivariateNormalDistribution.html>`_ at mathworld.
"""
Xmu = X-mux
Ymu = Y-muy
@@ -1074,13 +1146,16 @@
*x* is a very long trajectory from a map, and *fprime* returns the
derivative of *x*.
- Returns :math:`\lambda = \frac{1}{n}\sum \ln|f^'(x_i)|`
+ Returns :
+ .. math::
+ \lambda = \frac{1}{n}\sum \ln|f^'(x_i)|
+
.. seealso::
Sec 10.5 Strogatz (1994) "Nonlinear Dynamics and Chaos".
`Wikipedia article on Lyapunov Exponent
- http://en.wikipedia.org/wiki/Lyapunov_exponent`_.
+ <http://en.wikipedia.org/wiki/Lyapunov_exponent>`_.
.. note::
What the function here calculates may not be what you really want;
@@ -1510,14 +1585,15 @@
return np.diag(diag)
def identity(n, rank=2, dtype='l', typecode=None):
- """identity(n,r) returns the identity matrix of shape (n,n,...,n) (rank r).
+ """Returns the identity matrix of shape (n,n,...,n) (rank r).
For ranks higher than 2, this object is simply a multi-index Kronecker
- delta:
- / 1 if i0=i1=...=iR,
- id[i0,i1,...,iR] = -|
- \ 0 otherwise.
+ delta::
+ / 1 if i0=i1=...=iR,
+ id[i0,i1,...,iR] = -|
+ \ 0 otherwise.
+
Optionally a dtype (or typecode) may be given (it defaults to 'l').
Since rank defaults to 2, this function behaves in the default case (when
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-10-17 19:32:23
|
Revision: 6251
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6251&view=rev
Author: mdboom
Date: 2008-10-17 19:32:16 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
Include output images in examples in documentation.
Add "-*- noplot -*-" markers to examples where we don't want that.
The "plot" documentation directive now takes a path relative to the doc/ directory, not doc/pyplots.
Modified Paths:
--------------
trunk/matplotlib/doc/contents.rst
trunk/matplotlib/doc/devel/documenting_mpl.rst
trunk/matplotlib/doc/examples/gen_rst.py
trunk/matplotlib/doc/faq/howto_faq.rst
trunk/matplotlib/doc/pyplots/boxplot_demo.py
trunk/matplotlib/doc/pyplots/tex_demo.hires.png
trunk/matplotlib/doc/pyplots/tex_demo.pdf
trunk/matplotlib/doc/pyplots/tex_demo.png
trunk/matplotlib/doc/pyplots/tex_demo.py
trunk/matplotlib/doc/pyplots/tex_unicode_demo.hires.png
trunk/matplotlib/doc/pyplots/tex_unicode_demo.pdf
trunk/matplotlib/doc/pyplots/tex_unicode_demo.png
trunk/matplotlib/doc/sphinxext/plot_directive.py
trunk/matplotlib/doc/users/annotations.rst
trunk/matplotlib/doc/users/artists.rst
trunk/matplotlib/doc/users/mathtext.rst
trunk/matplotlib/doc/users/pyplot_tutorial.rst
trunk/matplotlib/doc/users/screenshots.rst
trunk/matplotlib/doc/users/text_intro.rst
trunk/matplotlib/doc/users/text_props.rst
trunk/matplotlib/doc/users/usetex.rst
trunk/matplotlib/examples/api/agg_oo.py
trunk/matplotlib/examples/api/font_family_rc.py
trunk/matplotlib/examples/api/font_file.py
trunk/matplotlib/examples/pylab_examples/annotation_demo.py
trunk/matplotlib/examples/pylab_examples/barh_demo.py
trunk/matplotlib/examples/pylab_examples/colours.py
trunk/matplotlib/examples/pylab_examples/cursor_demo.py
trunk/matplotlib/examples/pylab_examples/dannys_example.py
trunk/matplotlib/examples/pylab_examples/dashtick.py
trunk/matplotlib/examples/pylab_examples/font_table_ttf.py
trunk/matplotlib/examples/pylab_examples/ginput_demo.py
trunk/matplotlib/examples/pylab_examples/ginput_manual_clabel.py
trunk/matplotlib/examples/pylab_examples/movie_demo.py
trunk/matplotlib/examples/pylab_examples/print_stdout.py
trunk/matplotlib/examples/pylab_examples/pstest.py
trunk/matplotlib/examples/pylab_examples/scatter_profile.py
trunk/matplotlib/examples/pylab_examples/shared_axis_across_figures.py
trunk/matplotlib/examples/pylab_examples/simple_plot_fps.py
trunk/matplotlib/examples/pylab_examples/system_monitor.py
trunk/matplotlib/examples/pylab_examples/tex_unicode_demo.py
trunk/matplotlib/examples/pylab_examples/unicode_demo.py
trunk/matplotlib/examples/pylab_examples/webapp_demo.py
trunk/matplotlib/lib/matplotlib/artist.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/contour.py
trunk/matplotlib/lib/matplotlib/figure.py
trunk/matplotlib/lib/matplotlib/text.py
trunk/matplotlib/lib/matplotlib/transforms.py
Removed Paths:
-------------
trunk/matplotlib/doc/pyplots/contour_demo.py
trunk/matplotlib/doc/pyplots/errorbar_demo.py
trunk/matplotlib/doc/pyplots/tex_unicode_demo.py
trunk/matplotlib/examples/pylab_examples/auto_layout.py
Modified: trunk/matplotlib/doc/contents.rst
===================================================================
--- trunk/matplotlib/doc/contents.rst 2008-10-17 18:51:10 UTC (rev 6250)
+++ trunk/matplotlib/doc/contents.rst 2008-10-17 19:32:16 UTC (rev 6251)
@@ -20,9 +20,8 @@
api/index.rst
glossary/index.rst
-
.. htmlonly::
- examples/index.rst
+ - `Examples <examples/index.html>`_
* :ref:`genindex`
* :ref:`modindex`
Modified: trunk/matplotlib/doc/devel/documenting_mpl.rst
===================================================================
--- trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-10-17 18:51:10 UTC (rev 6250)
+++ trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-10-17 19:32:16 UTC (rev 6251)
@@ -208,47 +208,38 @@
Dynamically generated figures
-----------------------------
-The top level :file:`doc` dir has a folder called :file:`pyplots` in
-which you should include any pyplot plotting scripts that you want to
-generate figures for the documentation. It is not necessary to
-explicitly save the figure in the script, this will be done
-automatically at build time to insure that the code that is included
-runs and produces the advertised figure. Several figures will be
-saved with the same basnename as the filename when the documentation
-is generated (low and high res PNGs, a PDF). Matplotlib includes a
-Sphinx extension (:file:`sphinxext/plot_directive.py`) for generating
-the images from the python script and including either a png copy for
-html or a pdf for latex::
+Figures can be automatically generated from scripts and included in
+the docs. It is not necessary to explicitly save the figure in the
+script, this will be done automatically at build time to ensure that
+the code that is included runs and produces the advertised figure.
+Several figures will be saved with the same basename as the filename
+when the documentation is generated (low and high res PNGs, a PDF).
+Matplotlib includes a Sphinx extension
+(:file:`sphinxext/plot_directive.py`) for generating the images from
+the python script and including either a png copy for html or a pdf
+for latex::
- .. plot:: pyplot_simple.py
+ .. plot:: pyplots/pyplot_simple.py
:include-source:
+If the script produces multiple figures (through multiple calls to
+:func:`pyplot.figure`), each will be given a numbered file name and
+included.
+
+The path should be relative to the ``doc`` directory. Any plots
+specific to the documentation should be added to the ``doc/pyplots``
+directory and committed to SVN. Plots from the ``examples`` directory
+may be referenced through the symlink ``mpl_examples`` in the ``doc``
+directory. eg.::
+
+ .. plot:: mpl_examples/pylab_examples/simple_plot.py
+
The ``:scale:`` directive rescales the image to some percentage of the
original size, though we don't recommend using this in most cases
since it is probably better to choose the correct figure size and dpi
in mpl and let it handle the scaling. ``:include-source:`` will
present the contents of the file, marked up as source code.
-You can also point to local files with relative path. Use the
-sym-link for mpl_examples in case we do a reorganization of the doc
-directory at some point, eg::
-
- .. plot:: ../mpl_examples/pylab_examples/simple_plot.py
-
-If the example file needs to access data, it is easy to get screwed up
-with relative paths since the python example may be run from a diffent
-location in the plot directive build framework. To work around this,
-you can add your example data to mpl-data/example and refer to it in
-the example file like so::
-
- import matplotlib
- # datafile is a file object
- datafile = matplotlib.get_example_data('goog.npy')
- r = np.load(datafile).view(np.recarray)
-
-Try to keep the example datafiles relatively few and relatively small
-to control the size of the binaries we ship.
-
Static figures
--------------
@@ -261,10 +252,20 @@
requirements necessary to generate a new figure. Once these steps have been
taken, these figures can be included in the usual way::
- .. plot:: tex_unicode_demo.py
+ .. plot:: pyplots/tex_unicode_demo.py
:include-source
+Examples
+--------
+The source of the files in the ``examples`` directory are
+automatically included in the HTML docs. An image is generated and
+included for all examples in the ``api`` and ``pylab_examples``
+directories. To exclude the example from having an image rendered,
+insert the following special comment anywhere in the script::
+
+ # -*- noplot -*-
+
.. _referring-to-mpl-docs:
Referring to mpl documents
Modified: trunk/matplotlib/doc/examples/gen_rst.py
===================================================================
--- trunk/matplotlib/doc/examples/gen_rst.py 2008-10-17 18:51:10 UTC (rev 6250)
+++ trunk/matplotlib/doc/examples/gen_rst.py 2008-10-17 19:32:16 UTC (rev 6251)
@@ -5,12 +5,22 @@
import matplotlib.cbook as cbook
-
import os
+import re
import sys
fileList = []
rootdir = '../mpl_examples'
+def out_of_date(original, derived):
+ """
+ Returns True if derivative is out-of-date wrt original,
+ both of which are full file paths.
+ """
+ return (not os.path.exists(derived) or
+ os.stat(derived).st_mtime < os.stat(original).st_mtime)
+
+noplot_regex = re.compile(r"#\s*-\*-\s*noplot\s*-\*-")
+
datad = {}
for root, subFolders, files in os.walk(rootdir):
for fname in files:
@@ -22,7 +32,7 @@
contents = file(fullpath).read()
# indent
relpath = os.path.split(root)[-1]
- datad.setdefault(relpath, []).append((fname, contents))
+ datad.setdefault(relpath, []).append((fullpath, fname, contents))
subdirs = datad.keys()
subdirs.sort()
@@ -48,7 +58,7 @@
for subdir in subdirs:
if not os.path.exists(subdir):
os.makedirs(subdir)
-
+
static_dir = os.path.join('..', '_static', 'examples')
if not os.path.exists(static_dir):
os.makedirs(static_dir)
@@ -83,37 +93,48 @@
print subdir
-
+
data = datad[subdir]
data.sort()
- for fname, contents in data:
+ for fullname, fname, contents in data:
+ static_file = os.path.join(static_dir, fname)
+ basename, ext = os.path.splitext(fname)
+ rstfile = '%s.rst'%basename
+ outfile = os.path.join(subdir, rstfile)
+ fhsubdirIndex.write(' %s\n'%rstfile)
- static_file = os.path.join(static_dir, fname)
+ if (not out_of_date(fullname, static_file) and
+ not out_of_date(fullname, outfile)):
+ continue
+
+ print ' %s'%fname
+
fhstatic = file(static_file, 'w')
fhstatic.write(contents)
fhstatic.close()
- basename, ext = os.path.splitext(fname)
- rstfile = '%s.rst'%basename
- outfile = os.path.join(subdir, rstfile)
- fhsubdirIndex.write(' %s\n'%rstfile)
fh = file(outfile, 'w')
fh.write('.. _%s-%s:\n\n'%(subdir, basename))
title = '%s example code: %s'%(subdir, fname)
fh.write(title + '\n')
fh.write('='*len(title) + '\n\n')
-
- print ' %s'%fname
+ do_plot = (subdir in ('api',
+ 'pylab_examples',
+ 'units') and
+ not noplot_regex.search(contents))
- linkname = os.path.join('..', '..', '_static', 'examples', subdir, fname)
- fh.write('%s (`link to source <%s>`_)::\n\n'%(fname, linkname))
+ if do_plot:
+ fh.write("\n\n.. plot:: %s\n\n::\n\n" % fullname[3:])
+ else:
+ linkname = os.path.join('..', '..', '_static', 'examples', subdir, fname)
+ fh.write("[`source code <%s>`_]\n\n::\n\n" % linkname)
# indent the contents
contents = '\n'.join([' %s'%row.rstrip() for row in contents.split('\n')])
+ fh.write(contents)
- fh.write(contents)
fh.write('\n\nKeyword: codex (see :ref:`how-to-search-examples`)')
fh.close()
Modified: trunk/matplotlib/doc/faq/howto_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 18:51:10 UTC (rev 6250)
+++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 19:32:16 UTC (rev 6251)
@@ -148,7 +148,7 @@
of each of the labels and uses it to move the left of the subplots
over so that the tick labels fit in the figure
-.. plot:: auto_subplots_adjust.py
+.. plot:: pyplots/auto_subplots_adjust.py
:include-source:
.. _howto-ticks:
@@ -191,7 +191,7 @@
below shows the default behavior in the left subplots, and the manual
setting in the right subplots.
-.. plot:: align_ylabels.py
+.. plot:: pyplots/align_ylabels.py
:include-source:
.. _date-index-plots:
Modified: trunk/matplotlib/doc/pyplots/boxplot_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/boxplot_demo.py 2008-10-17 18:51:10 UTC (rev 6250)
+++ trunk/matplotlib/doc/pyplots/boxplot_demo.py 2008-10-17 19:32:16 UTC (rev 6251)
@@ -1,21 +1,55 @@
-import numpy as np
-import matplotlib.pyplot as plt
+#!/usr/bin/python
-spread = np.random.rand(50) * 100
-center = np.ones(25) * 50
-flier_high = np.random.rand(10) * 100 + 100
-flier_low = np.random.rand(10) * -100
-data = np.concatenate((spread, center, flier_high, flier_low), 0)
+#
+# Example boxplot code
+#
+from pylab import *
+
+# fake up some data
+spread= rand(50) * 100
+center = ones(25) * 50
+flier_high = rand(10) * 100 + 100
+flier_low = rand(10) * -100
+data =concatenate((spread, center, flier_high, flier_low), 0)
+
+# basic plot
+boxplot(data)
+#savefig('box1')
+
+# notched plot
+figure()
+boxplot(data,1)
+#savefig('box2')
+
+# change outlier point symbols
+figure()
+boxplot(data,0,'gD')
+#savefig('box3')
+
+# don't show outlier points
+figure()
+boxplot(data,0,'')
+#savefig('box4')
+
+# horizontal boxes
+figure()
+boxplot(data,0,'rs',0)
+#savefig('box5')
+
+# change whisker length
+figure()
+boxplot(data,0,'rs',0,0.75)
+#savefig('box6')
+
# fake up some more data
-spread = np.random.rand(50) * 100
-center = np.ones(25) * 40
-flier_high = np.random.rand(10) * 100 + 100
-flier_low = np.random.rand(10) * -100
-d2 = np.concatenate( (spread, center, flier_high, flier_low), 0 )
+spread= rand(50) * 100
+center = ones(25) * 40
+flier_high = rand(10) * 100 + 100
+flier_low = rand(10) * -100
+d2 = concatenate( (spread, center, flier_high, flier_low), 0 )
data.shape = (-1, 1)
d2.shape = (-1, 1)
-
#data = concatenate( (data, d2), 1 )
# Making a 2-D array only works if all the columns are the
# same length. If they are not, then use a list instead.
@@ -23,7 +57,9 @@
# a 2-D array into a list of vectors internally anyway.
data = [data, d2, d2[::2,0]]
# multiple box plots on one figure
+figure()
+boxplot(data)
+#savefig('box7')
-plt.boxplot(data)
-plt.show()
+show()
Deleted: trunk/matplotlib/doc/pyplots/contour_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/contour_demo.py 2008-10-17 18:51:10 UTC (rev 6250)
+++ trunk/matplotlib/doc/pyplots/contour_demo.py 2008-10-17 19:32:16 UTC (rev 6251)
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-"""
-Illustrate simple contour plotting, contours on an image with
-a colorbar for the contours, and labelled contours.
-
-See also contour_image.py.
-"""
-import matplotlib
-import numpy as np
-import matplotlib.cm as cm
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-
-matplotlib.rcParams['xtick.direction'] = 'out'
-matplotlib.rcParams['ytick.direction'] = 'out'
-
-delta = 0.025
-x = np.arange(-3.0, 3.0, delta)
-y = np.arange(-2.0, 2.0, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-# difference of Gaussians
-Z = 10.0 * (Z2 - Z1)
-
-
-# You can use a colormap to specify the colors; the default
-# colormap will be used for the contour lines
-plt.figure()
-im = plt.imshow(Z, interpolation='bilinear', origin='lower',
- cmap=cm.gray, extent=(-3,3,-2,2))
-levels = np.arange(-1.2, 1.6, 0.2)
-CS = plt.contour(Z, levels,
- origin='lower',
- linewidths=2,
- extent=(-3,3,-2,2))
-
-#Thicken the zero contour.
-zc = CS.collections[6]
-plt.setp(zc, linewidth=4)
-
-plt.clabel(CS, levels[1::2], # label every second level
- inline=1,
- fmt='%1.1f',
- fontsize=14)
-
-# make a colorbar for the contour lines
-CB = plt.colorbar(CS, shrink=0.8, extend='both')
-
-plt.title('Lines with colorbar')
-#plt.hot() # Now change the colormap for the contour lines and colorbar
-plt.flag()
-
-# We can still add a colorbar for the image, too.
-CBI = plt.colorbar(im, orientation='horizontal', shrink=0.8)
-
-# This makes the original colorbar look a bit out of place,
-# so let's improve its position.
-
-l,b,w,h = plt.gca().get_position().bounds
-ll,bb,ww,hh = CB.ax.get_position().bounds
-CB.ax.set_position([ll, b+0.1*h, ww, h*0.8])
-
-
-#savefig('contour_demo')
-plt.show()
Deleted: trunk/matplotlib/doc/pyplots/errorbar_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/errorbar_demo.py 2008-10-17 18:51:10 UTC (rev 6250)
+++ trunk/matplotlib/doc/pyplots/errorbar_demo.py 2008-10-17 19:32:16 UTC (rev 6251)
@@ -1,8 +0,0 @@
-import numpy as np
-import matplotlib.pyplot as plt
-
-t = np.arange(0.1, 4, 0.1)
-s = np.exp(-t)
-e, f = 0.1*np.absolute(np.random.randn(2, len(s)))
-plt.errorbar(t, s, e, fmt='o') # vertical symmetric
-plt.show()
Modified: trunk/matplotlib/doc/pyplots/tex_demo.hires.png
===================================================================
(Binary files differ)
Modified: trunk/matplotlib/doc/pyplots/tex_demo.pdf
===================================================================
--- trunk/matplotlib/doc/pyplots/tex_demo.pdf 2008-10-17 18:51:10 UTC (rev 6250)
+++ trunk/matplotlib/doc/pyplots/tex_demo.pdf 2008-10-17 19:32:16 UTC (rev 6251)
@@ -4,7 +4,7 @@
<< /Type /Catalog /Pages 3 0 R >>
endobj
2 0 obj
-<< /CreationDate (D:20081014161405-05'00')
+<< /CreationDate (D:20081017151352-04'00')
/Producer (matplotlib pdf backend)
/Creator (matplotlib 0.98.3, http://matplotlib.sf.net) >>
endobj
@@ -44,673 +44,291 @@
1864
endobj
36 0 obj
-<< /BaseFont /CMMI12 /Type /Font /Subtype /Type1 /FontDescriptor 35 0 R
+<<
+/Encoding <<
+/Differences [ 0 /minus /periodcentered /multiply /asteriskmath /divide /diamondmath
+/plusminus /minusplus /circleplus /circleminus /circlemultiply
+/circledivide /circledot /circlecopyrt /openbullet /bullet /equivasymptotic
+/equivalence /reflexsubset /reflexsuperset /lessequal /greaterequal
+/precedesequal /followsequal /similar /approxequal /propersubset
+/propersuperset /lessmuch /greatermuch /precedes /follows /arrowleft
+/arrowright /arrowup /arrowdown /arrowboth /arrownortheast /arrowsoutheast
+/similarequal /arrowdblleft /arrowdblright /arrowdblup /arrowdbldown
+/arrowdblboth /arrownorthwest /arrowsouthwest /proportional /prime
+/infinity /element /owner /triangle /triangleinv /negationslash /mapsto
+/universal /existential /logicalnot /emptyset /Rfractur /Ifractur
+/latticetop /perpendicular /aleph /A /B /C /D /E /F /G /H /I /J /K /L /M /N
+/O /P /Q /R /S /T /U /V /W /X /Y /Z /union /intersection /unionmulti
+/logicaland /logicalor /turnstileleft /turnstileright /floorleft
+/floorright /ceilingleft /ceilingright /braceleft /braceright
+/angbracketleft /angbracketright /bar /bardbl /arrowbothv /arrowdblbothv
+/backslash /wreathproduct /radical /coproduct /nabla /integral /unionsq
+/intersectionsq /subsetsqequal /supersetsqequal /section /dagger /daggerdbl
+/paragraph /club /diamond /heart /spade /arrowleft /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /minus
+/periodcentered /multiply /asteriskmath /divide /diamondmath /plusminus
+/minusplus /circleplus /circleminus /.notdef /.notdef /circlemultiply
+/circledivide /circledot /circlecopyrt /openbullet /bullet /equivasymptotic
+/equivalence /reflexsubset /reflexsuperset /lessequal /greaterequal
+/precedesequal /followsequal /similar /approxequal /propersubset
+/propersuperset /lessmuch /greatermuch /precedes /follows /arrowleft /spade
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef ]
+/Type /Encoding >>
+/BaseFont /CMSY10 /Type /Font /Subtype /Type1 /FontDescriptor 35 0 R
/Widths 34 0 R /LastChar 125 /FirstChar 0 >>
endobj
34 0 obj
-[ 606 815 748 679 728 811 765 571 652 598 757 622 552 507 433 395 427 483
-456 346 563 571 589 483 427 555 505 556 425 527 579 613 636 609 458 577 808
-505 354 641 979 979 979 979 271 271 489 489 489 489 489 489 489 489 489 489
-489 489 271 271 761 489 761 489 516 734 743 700 812 724 633 772 811 431 541
-833 666 947 784 748 631 775 745 602 573 665 570 924 812 568 670 380 380 380
-979 979 410 513 416 421 508 453 482 468 563 334 405 509 291 856 584 470 491
-434 441 461 353 557 473 699 556 477 454 312 377 623 ]
+[ 777 277 777 500 777 500 777 777 777 777 777 777 777 1000 500 500 777 777
+777 777 777 777 777 777 777 777 777 777 1000 1000 777 777 1000 1000 500 500
+1000 1000 1000 777 1000 1000 611 611 1000 1000 1000 777 274 1000 666 666
+888 888 0 0 555 555 666 500 722 722 777 777 611 798 656 526 771 527 718 594
+844 544 677 761 689 1200 820 796 695 816 847 605 544 625 612 987 713 668
+724 666 666 666 666 666 611 611 444 444 444 444 500 500 388 388 277 500 500
+611 500 277 833 750 833 416 666 666 777 777 444 444 444 611 777 777 ]
endobj
35 0 obj
-<< /FontFile 37 0 R /FontName /CMMI12 /Descent -250
-/FontBBox [ -30 -250 1026 750 ] /CapHeight 1000 /Ascent 750
+<< /FontFile 37 0 R /FontName /CMSY10 /Descent -960
+/FontBBox [ -29 -960 1116 775 ] /CapHeight 1000 /Ascent 775
/FontFamily (Computer Modern) /StemV 50 /Flags 68 /XHeight 500
/ItalicAngle -14 /Type /FontDescriptor >>
endobj
37 0 obj
-<< /Length3 0 /Length2 27245 /Length1 3667 /Length 28908
+<< /Length3 0 /Length2 21763 /Length1 4313 /Length 23626
/Filter /FlateDecode >>
stream
-x\x9C\x94\xB7eX˺\xB5\x8D\xBBC\x90`3@pwww
- \xD8\xC4\xDD\xDD=\xB7\xE0Np\xF7\xE0\xC1\xDD\x82{p\xF8f\xF6\xD9\xEF Y\xEB\xFC\xF9.\xFE0Fu\xEB\xA9\xD1\xF5t\xBF\xA7\xA8B'ddc |
|
From: <jd...@us...> - 2008-10-17 18:51:20
|
Revision: 6250
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6250&view=rev
Author: jdh2358
Date: 2008-10-17 18:51:10 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
reorg how to faq
Modified Paths:
--------------
trunk/matplotlib/doc/faq/howto_faq.rst
trunk/matplotlib/doc/make.py
Modified: trunk/matplotlib/doc/faq/howto_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 18:20:09 UTC (rev 6249)
+++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 18:51:10 UTC (rev 6250)
@@ -7,10 +7,15 @@
.. contents::
+.. _howto-plotting:
+
+Plotting: howto
+=================
+
.. _howto-findobj:
Find all objects in figure of a certain type
-=============================================================
+-------------------------------------------------------------
Every matplotlib artist (see :ref:`artist-tutorial`) has a method
called :meth:`~matplotlib.artist.Artist.findobj` that can be used to
@@ -36,7 +41,7 @@
.. _howto-transparent:
Save transparent figures
-==================================
+----------------------------------
The :meth:`~matplotlib.pyplot.savefig` command has a keyword argument
*transparent* which, if True, will make the figure and axes
@@ -65,7 +70,7 @@
.. _howto-subplots-adjust:
Move the edge of an axes to make room for tick labels
-============================================================================
+----------------------------------------------------------------------------
For subplots, you can control the default spacing on the left, right,
bottom, and top as well as the horizontal and vertical spacing between
@@ -115,7 +120,7 @@
.. _howto-auto-adjust:
Automatically make room for tick labels
-====================================================
+----------------------------------------------------
In most use cases, it is enough to simpy change the subplots adjust
parameters as described in :ref:`howto-subplots-adjust`. But in some
@@ -149,7 +154,7 @@
.. _howto-ticks:
Configure the tick linewidths
-=======================================
+---------------------------------------
In matplotlib, the ticks are *markers*. All
:class:`~matplotlib.lines.Line2D` objects support a line (solid,
@@ -175,7 +180,7 @@
.. _howto-align-label:
Align my ylabels across multiple subplots
-===================================================
+---------------------------------------------------
If you have multiple subplots over one another, and the y data have
different scales, you can often get ylabels that do not align
@@ -189,74 +194,10 @@
.. plot:: align_ylabels.py
:include-source:
-.. _howto-webapp:
-
-Matplotlib in a web application server
-====================================================
-
-Many users report initial problems trying to use maptlotlib in web
-application servers, because by default matplotlib ships configured to
-work with a graphical user interface which may require an X11
-connection. Since many barebones application servers do not have X11
-enabled, you may get errors if you don't configure matplotlib for use
-in these environments. Most importantly, you need to decide what
-kinds of images you want to generate (PNG, PDF, SVG) and configure the
-appropriate default backend. For 99% of users, this will be the Agg
-backend, which uses the C++ `antigrain <http://antigrain.com>`_
-rendering engine to make nice PNGs. The Agg backend is also
-configured to recognize requests to generate other output formats
-(PDF, PS, EPS, SVG). The easiest way to configure matplotlib to use
-Agg is to call::
-
- # do this before importing pylab or pyplot
- import matplotlib
- matplotlib.use('Agg')
- import matplotlib.pyplot as plt
-
-For more on configuring your backend, see
-:ref:`what-is-a-backend`.
-
-Alternatively, you can avoid pylab/pyplot altogeher, which will give
-you a little more control, by calling the API directly as shown in
-`agg_oo.py <http://matplotlib.sf.net/examples/api/agg_oo.py>`_ .
-
-You can either generate hardcopy on the filesystem by calling savefig::
-
- # do this before importing pylab or pyplot
- import matplotlib
- matplotlib.use('Agg')
- import matplotlib.pyplot as plt
- fig = plt.figure()
- ax = fig.add_subplot(111)
- ax.plot([1,2,3])
- fig.savefig('test.png')
-
-or by saving to a file handle::
-
- import sys
- fig.savefig(sys.stdout)
-
-
-matplotlib with apache
-------------------------------------
-
-TODO
-
-matplotlib with django
-------------------------------------
-
-TODO
-
-matplotlib with zope
-----------------------------------
-
-TODO
-
-
.. _date-index-plots:
Skip dates where there is no data
-===========================================
+-------------------------------------
When plotting time series, eg financial time series, one often wants
to leave out days on which there is no data, eg weekends. By passing
@@ -293,7 +234,7 @@
.. _point-in-poly:
Test whether a point is inside a polygon
-==================================================
+-------------------------------------------
The :mod:`matplotlib.nxutils` provides two high performance methods:
for a single point use :func:`~matplotlib.nxutils.pnpoly` and for an
@@ -337,123 +278,12 @@
For a complete example, see :ref:`event_handling-lasso_demo`.
-
-.. _how-to-submit-patch:
-
-Submit a patch
-========================
-
-First obtain a copy of matplotlib svn (see :ref:`install-svn`) and
-make your changes to the matplotlib source code or documentation and
-apply a `svn diff`. If it is feasible, do your diff from the top
-level directory, the one that contains :file:`setup.py`. Eg,::
-
- > cd /path/to/matplotlib/source
- > svn diff > mypatch.diff
-
-and then post your patch to the `matplotlib-devel
-<http://sourceforge.net/mail/?group_id=80706>`_ mailing list. If you
-do not get a response within 24 hours, post your patch to the
-sourceforge patch `tracker
-<http://sourceforge.net/tracker2/?atid=560722&group_id=80706&func=browse>`_,
-and follow up on the mailing list with a link to the sourceforge patch
-submissions. If you still do not hear anything within a week (this
-shouldn't happen!), send us a kind and gentle reminder on the mailing
-list.
-
-If you have made lots of local changes and do not want to a diff
-against the entire tree, but rather against a single directory or
-file, that is fine, but we do prefer svn diffs against HEAD.
-
-You should check out the guide to developing matplotlib to make sure
-your patch abides by our coding conventions
-:ref:`developers-guide-index`.
-
-
-.. _how-to-contribute-docs:
-
-Contribute to matplotlib documentation
-=========================================
-
-matplotlib is a big library, which is used in many ways, and the
-documentation we have only scratches the surface of everything it can
-do. So far, the place most people have learned all these features are
-through studying the examples (:ref:`how-to-search-examples`), which is a
-recommended and great way to learn, but it would be nice to have more
-official narrative documentation guiding people through all the dark
-corners. This is where you come in.
-
-There is a good chance you know more about matplotlib usage in some
-areas, the stuff you do every day, than any of the developers. *Just
-pulled your hair out compiling matplotlib for windows?* Write a FAQ or
-a section for the :ref:`installing` page. *Are you a digital signal
-processing wizard?* Write a tutorial on the signal analysis plotting
-functions like :func:`~matplotlib.pyplot.xcorr`,
-:func:`~matplotlib.pyplot.psd` and
-:func:`~matplotlib.pyplot.specgram`. *Do you use matplotlib with
-`django <ttp://www.djangoproject.com/>`_ or other popular web
-application servers?* Write a FAQ or tutorial and we'll find a place
-for it in the :ref:`users-guide-index`. *Bundle matplotlib in a `py2exe
-<http://www.py2exe.org/>`_ app?* ... I think you get the idea.
-
-matplotlib is documented using the `sphinx
-<http://sphinx.pocoo.org/index.html>`_ extensions to restructured text
-`ReST <http://docutils.sourceforge.net/rst.html>`_. sphinx is a
-extensible python framework for documentation projects which generates
-HTML and PDF, and is pretty easy to write; you can see the source for this
-document or any page on this site by clicking on *Show Source* link
-at the end of the page in the sidebar (or `here
-<../_sources/faq/howto_faq.txt>`_ for this document).
-
-The sphinx website is a good resource for learning sphinx, but we have
-put together a cheat-sheet at :ref:`documenting-matplotlib` which
-shows you how to get started, and outlines the matplotlib conventions
-and extensions, eg for including plots directly from external code in
-your documents.
-
-Once your documentation contributions are working (and hopefully
-tested by actually *building* the docs) you can submit them as a patch
-against svn. See :ref:`install-svn` and :ref:`how-to-submit-patch`.
-Looking for something to do? Search for ``TODO`` at :`search`.
-
-
-.. _how-to-search-examples:
-
-Search examples
-=========================================
-
-The nearly 300 code :ref:`examples-index` included with the matplotlib
-source distribution are full-text searchable from the :ref:`search`
-page, but sometimes when you search, you get a lot of results from the
-:ref:`api-index` or other documentation that you may not be interested in if
-you just want to find a complete, free-standing, working piece of
-example code. To facilitate example searches, we have tagged every
-page with the keyword ``codex`` for *code example* which shouldn't
-appear anywhere else on this site except in the FAQ and in every
-example. So if you want to search for an example that uses an ellipse,
-:ref:`search` for ``codex ellipse``.
-
-
-
-
-.. _howto-click-maps:
-
-Clickable images for HTML
-=========================
-
-Andrew Dalke of `Dalke Scientific <http://www.dalkescientific.com>`_
-has written a nice `article
-<http://www.dalkescientific.com/writings/diary/archive/2005/04/24/interactive_html.html>`_
-on how to make html click maps with matplotlib agg PNGs. We would
-also like to add this functionality to SVG and add a SWF backend to
-support these kind of images. If you are interested in contributing
-to these efforts that would be great.
-
.. _howto-set-zorder:
Control the depth of plot elements
-=============================================
+---------------------------------------
+
Within an axes, the order that the various lines, markers, text,
collections, etc appear is determined by the
:meth:`matplotlib.artist.Artist.set_zorder` property. The default
@@ -463,8 +293,6 @@
line, = ax.plot(x, y, zorder=10)
-
-
.. htmlonly::
See :ref:`pylab_examples-zorder_demo` for a complete example.
@@ -476,7 +304,7 @@
.. _howto-axis-equal:
Make the aspect ratio for plots equal
-===============================================
+-------------------------------------------
The Axes property :meth:`matplotlib.axes.Axes.set_aspect` controls the
aspect ratio of the axes. You can set it to be 'auto', 'equal', or
@@ -494,7 +322,7 @@
.. _howto-movie:
Make a movie
-======================
+-----------------------------------------------
If you want to take an animated plot and turn it into a movie, the
@@ -542,7 +370,7 @@
.. _howto-twoscale:
Multiple y-axis scales
-==================================
+-------------------------------
A frequent request is to have two scales for the left and right
y-axis, which is possible using :func:`~matplotlib.pyplot.twinx` (more
@@ -583,7 +411,7 @@
.. _howto-batch:
Generate images without having a window popup
-===========================================================
+--------------------------------------------------
The easiest way to do this is use an image backend (see
:ref:`what-is-a-backend`) such as Agg (for PNGs), PDF, SVG or PS. In
@@ -604,7 +432,7 @@
.. _howto-show
Use :func:`~matplotlib.pyplot.show`
-=====================================================
+------------------------------------------
The user interface backends need to start the GUI mainloop, and this
is what :func:`~matplotlib.pyplot.show` does. It tells matplotlib to
@@ -656,3 +484,188 @@
though we have made some pregress towards supporting blocking events.
+.. _howto-contribute:
+
+Contributing: howto
+=====================
+
+.. _how-to-submit-patch:
+
+Submit a patch
+-----------------
+
+First obtain a copy of matplotlib svn (see :ref:`install-svn`) and
+make your changes to the matplotlib source code or documentation and
+apply a `svn diff`. If it is feasible, do your diff from the top
+level directory, the one that contains :file:`setup.py`. Eg,::
+
+ > cd /path/to/matplotlib/source
+ > svn diff > mypatch.diff
+
+and then post your patch to the `matplotlib-devel
+<http://sourceforge.net/mail/?group_id=80706>`_ mailing list. If you
+do not get a response within 24 hours, post your patch to the
+sourceforge patch `tracker
+<http://sourceforge.net/tracker2/?atid=560722&group_id=80706&func=browse>`_,
+and follow up on the mailing list with a link to the sourceforge patch
+submissions. If you still do not hear anything within a week (this
+shouldn't happen!), send us a kind and gentle reminder on the mailing
+list.
+
+If you have made lots of local changes and do not want to a diff
+against the entire tree, but rather against a single directory or
+file, that is fine, but we do prefer svn diffs against HEAD.
+
+You should check out the guide to developing matplotlib to make sure
+your patch abides by our coding conventions
+:ref:`developers-guide-index`.
+
+
+.. _how-to-contribute-docs:
+
+Contribute to matplotlib documentation
+-----------------------------------------
+
+matplotlib is a big library, which is used in many ways, and the
+documentation we have only scratches the surface of everything it can
+do. So far, the place most people have learned all these features are
+through studying the examples (:ref:`how-to-search-examples`), which is a
+recommended and great way to learn, but it would be nice to have more
+official narrative documentation guiding people through all the dark
+corners. This is where you come in.
+
+There is a good chance you know more about matplotlib usage in some
+areas, the stuff you do every day, than many of the core developers
+who write most of the documentation. Just pulled your hair out
+compiling matplotlib for windows? Write a FAQ or a section for the
+:ref:`installing` page. Are you a digital signal processing wizard?
+Write a tutorial on the signal analysis plotting functions like
+:func:`~matplotlib.pyplot.xcorr`, :func:`~matplotlib.pyplot.psd` and
+:func:`~matplotlib.pyplot.specgram`. Do you use matplotlib with
+`django <http://www.djangoproject.com>`_ or other popular web
+application servers? Write a FAQ or tutorial and we'll find a place
+for it in the :ref:`users-guide-index`. Bundle matplotlib in a
+`py2exe <http://www.py2exe.org/>`_ app? ... I think you get the idea.
+
+matplotlib is documented using the `sphinx
+<http://sphinx.pocoo.org/index.html>`_ extensions to restructured text
+`ReST <http://docutils.sourceforge.net/rst.html>`_. sphinx is a
+extensible python framework for documentation projects which generates
+HTML and PDF, and is pretty easy to write; you can see the source for this
+document or any page on this site by clicking on *Show Source* link
+at the end of the page in the sidebar (or `here
+<../_sources/faq/howto_faq.txt>`_ for this document).
+
+The sphinx website is a good resource for learning sphinx, but we have
+put together a cheat-sheet at :ref:`documenting-matplotlib` which
+shows you how to get started, and outlines the matplotlib conventions
+and extensions, eg for including plots directly from external code in
+your documents.
+
+Once your documentation contributions are working (and hopefully
+tested by actually *building* the docs) you can submit them as a patch
+against svn. See :ref:`install-svn` and :ref:`how-to-submit-patch`.
+Looking for something to do? Search for `TODO <../search.html?q=todo>`_.
+
+
+
+
+.. _howto-webapp:
+
+Matplotlib in a web application server
+====================================================
+
+Many users report initial problems trying to use maptlotlib in web
+application servers, because by default matplotlib ships configured to
+work with a graphical user interface which may require an X11
+connection. Since many barebones application servers do not have X11
+enabled, you may get errors if you don't configure matplotlib for use
+in these environments. Most importantly, you need to decide what
+kinds of images you want to generate (PNG, PDF, SVG) and configure the
+appropriate default backend. For 99% of users, this will be the Agg
+backend, which uses the C++ `antigrain <http://antigrain.com>`_
+rendering engine to make nice PNGs. The Agg backend is also
+configured to recognize requests to generate other output formats
+(PDF, PS, EPS, SVG). The easiest way to configure matplotlib to use
+Agg is to call::
+
+ # do this before importing pylab or pyplot
+ import matplotlib
+ matplotlib.use('Agg')
+ import matplotlib.pyplot as plt
+
+For more on configuring your backend, see
+:ref:`what-is-a-backend`.
+
+Alternatively, you can avoid pylab/pyplot altogeher, which will give
+you a little more control, by calling the API directly as shown in
+`agg_oo.py <http://matplotlib.sf.net/examples/api/agg_oo.py>`_ .
+
+You can either generate hardcopy on the filesystem by calling savefig::
+
+ # do this before importing pylab or pyplot
+ import matplotlib
+ matplotlib.use('Agg')
+ import matplotlib.pyplot as plt
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ ax.plot([1,2,3])
+ fig.savefig('test.png')
+
+or by saving to a file handle::
+
+ import sys
+ fig.savefig(sys.stdout)
+
+
+matplotlib with apache
+------------------------------------
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+matplotlib with django
+------------------------------------
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+matplotlib with zope
+----------------------------------
+
+TODO; see :ref:`how-to-contribute-docs`.
+
+.. _howto-click-maps:
+
+Clickable images for HTML
+-------------------------
+
+Andrew Dalke of `Dalke Scientific <http://www.dalkescientific.com>`_
+has written a nice `article
+<http://www.dalkescientific.com/writings/diary/archive/2005/04/24/interactive_html.html>`_
+on how to make html click maps with matplotlib agg PNGs. We would
+also like to add this functionality to SVG and add a SWF backend to
+support these kind of images. If you are interested in contributing
+to these efforts that would be great.
+
+
+.. _how-to-search-examples:
+
+Search examples
+=========================================
+
+The nearly 300 code :ref:`examples-index` included with the matplotlib
+source distribution are full-text searchable from the :ref:`search`
+page, but sometimes when you search, you get a lot of results from the
+:ref:`api-index` or other documentation that you may not be interested in if
+you just want to find a complete, free-standing, working piece of
+example code. To facilitate example searches, we have tagged every
+page with the keyword ``codex`` for *code example* which shouldn't
+appear anywhere else on this site except in the FAQ and in every
+example. So if you want to search for an example that uses an ellipse,
+:ref:`search` for ``codex ellipse``.
+
+
+
+
+
+
+
Modified: trunk/matplotlib/doc/make.py
===================================================================
--- trunk/matplotlib/doc/make.py 2008-10-17 18:20:09 UTC (rev 6249)
+++ trunk/matplotlib/doc/make.py 2008-10-17 18:51:10 UTC (rev 6250)
@@ -27,13 +27,14 @@
def figs():
os.system('cd users/figures/ && python make.py')
+def examples():
+ 'make the rest examples'
+ os.system('cd examples; svn-clean; python gen_rst.py')
+
def html():
check_build()
- # build the literal include examples for searchable examples
- os.system('cd examples; python gen_rst.py')
-
-
-
+ if not os.path.exists('examples/index.rst'):
+ examples()
#figs()
if os.system('sphinx-build -b html -d build/doctrees . build/html'):
raise SystemExit("Building HTML failed.")
@@ -67,13 +68,11 @@
print 'latex build has not been tested on windows'
def clean():
- if os.path.exists('build'):
- shutil.rmtree('build')
- for fname in glob.glob('pyplots/*.png') + glob.glob('pyplots/*.pdf'):
- os.remove(fname)
+ os.system('svn-clean')
def all():
#figs()
+ examples()
html()
latex()
@@ -84,6 +83,7 @@
'clean':clean,
'sf':sf,
'sfpdf':sfpdf,
+ 'examples':examples,
'all':all,
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 18:20:12
|
Revision: 6249
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6249&view=rev
Author: jdh2358
Date: 2008-10-17 18:20:09 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
one more fix to the search template
Added Paths:
-----------
trunk/matplotlib/doc/_templates/search.html
Added: trunk/matplotlib/doc/_templates/search.html
===================================================================
--- trunk/matplotlib/doc/_templates/search.html (rev 0)
+++ trunk/matplotlib/doc/_templates/search.html 2008-10-17 18:20:09 UTC (rev 6249)
@@ -0,0 +1,42 @@
+{% extends "layout.html" %}
+{% set title = _('Search') %}
+{% set script_files = script_files + ['_static/searchtools.js'] %}
+{% block body %}
+ <h1 id="search-documentation">{{ _('Search') }}</h1>
+ <p>
+ {% trans %}From here you can search these documents. Enter your
+ search words into the box below and click "search". Note that the
+ search function will automatically search for all of the
+ words. Pages containing less words won't appear in the result
+ list.{% endtrans %} If you want to limit your search to working code examples,
+ include the keyword "codex" (mnemonic for <i>code example</i>) in your
+ search, eg "codex ellipse";
+ see <a href="{{ pathto('faq/howto_faq.html#search-examples') }}">search examples</a>.
+ </p>
+ <form action="" method="get">
+ <input type="text" name="q" value="" />
+ <input type="submit" value="{{ _('search') }}" />
+ <span id="search-progress" style="padding-left: 10px"></span>
+ </form>
+ {% if search_performed %}
+ <h2>{{ _('Search Results') }}</h2>
+ {% if not search_results %}
+ <p>{{ _('Your search did not match any results.') }}</p>
+ {% endif %}
+ {% endif %}
+ <div id="search-results">
+ {% if search_results %}
+ <ul>
+ {% for href, caption, context in search_results %}
+ <li><a href="{{ pathto(item.href) }}">{{ caption }}</a>
+ <div class="context">{{ context|e }}</div>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ </div>
+{% endblock %}
+{% block footer %}
+ {{ super() }}
+ <script type="text/javascript" src="searchindex.js"></script>
+{% endblock %}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 18:14:03
|
Revision: 6248
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6248&view=rev
Author: jdh2358
Date: 2008-10-17 18:14:01 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
moved the screenshots link to the center
Modified Paths:
--------------
trunk/matplotlib/doc/_templates/index.html
trunk/matplotlib/doc/_templates/indexsidebar.html
trunk/matplotlib/doc/api/axes_api.rst
trunk/matplotlib/doc/make.py
Modified: trunk/matplotlib/doc/_templates/index.html
===================================================================
--- trunk/matplotlib/doc/_templates/index.html 2008-10-17 18:01:18 UTC (rev 6247)
+++ trunk/matplotlib/doc/_templates/index.html 2008-10-17 18:14:01 UTC (rev 6248)
@@ -15,10 +15,19 @@
<p>matplotlib tries to make easy things easy and hard things possible.
You can generate plots, histograms, power spectra, bar charts,
- errorcharts, scatterplots, etc, with just a few lines of code. For
- example, to generate 10,000 gaussian random numbers and make a
- histogram plot binning the data into 100 bins, you simply need to type</p>
+ errorcharts, scatterplots, etc, with just a few lines of code.
+ For a sampling, see the <a href="{{ pathto('users/screenshots') }}">screenshots</a> and
+<a href="examples/index.html">examples</a></p>
+ <p align="center"><a href="{{ pathto('users/screenshots') }}"><img align="middle"
+ src="{{ pathto('_static/logo_sidebar_horiz.png', 1) }}" border="0"
+ alt="screenshots"/></a></p>
+
+
+ For example, to generate 10,000 gaussian random numbers and make a
+ histogram plot binning the data into 100 bins, you simply need to
+ type</p>
+
<pre>
>>> from pylab import randn, hist
>>> x = randn(10000)
@@ -26,9 +35,8 @@
<p>For the power user, you have full control of line styles, font
properties, axes properties, etc, via an object oriented interface
- or via a handle graphics interface familiar to Matlab® users.</p>
-
- <p>The plotting functions in the <a href="api/pyplot_api.html">pyplot</a>
+ or via a handle graphics interface familiar to Matlab® users.
+ The plotting functions in the <a href="api/pyplot_api.html">pyplot</a>
interface have a high degree of Matlab® compatibility.</p>
<h3>Plotting commands</h3>
Modified: trunk/matplotlib/doc/_templates/indexsidebar.html
===================================================================
--- trunk/matplotlib/doc/_templates/indexsidebar.html 2008-10-17 18:01:18 UTC (rev 6247)
+++ trunk/matplotlib/doc/_templates/indexsidebar.html 2008-10-17 18:14:01 UTC (rev 6248)
@@ -28,15 +28,7 @@
<a href="http://sourceforge.net/tracker2/?group_id=80706">tracker</a>,
but it is a good idea to ping us on the mailing list too.</p>
-<h3>Screenshots</h3>
-<p><a href="{{ pathto('users/screenshots') }}"><img align="middle"
-src="{{ pathto('_static/logo_sidebar.png', 1) }}" border="0"
-alt="screenshots"/></a></p>
-
-<p><a href="{{ pathto('users/screenshots') }}">screenshots</a> and
-<a href="examples/index.html">examples</a></p>
-
<h3>Other stuff</h3>
<p>The matplotlib <a href="{{ pathto('users/license') }}">license</a>
Modified: trunk/matplotlib/doc/api/axes_api.rst
===================================================================
--- trunk/matplotlib/doc/api/axes_api.rst 2008-10-17 18:01:18 UTC (rev 6247)
+++ trunk/matplotlib/doc/api/axes_api.rst 2008-10-17 18:14:01 UTC (rev 6248)
@@ -10,3 +10,4 @@
:members:
:undoc-members:
:show-inheritance:
+
Modified: trunk/matplotlib/doc/make.py
===================================================================
--- trunk/matplotlib/doc/make.py 2008-10-17 18:01:18 UTC (rev 6247)
+++ trunk/matplotlib/doc/make.py 2008-10-17 18:14:01 UTC (rev 6248)
@@ -16,7 +16,7 @@
def sf():
'push a copy to the sf site'
- os.system('cd build/html; rsync -avz . jdh2358,mat...@we...:/home/groups/m/ma/matplotlib/htdocs/ -essh')
+ os.system('cd build/html; rsync -avz . jdh2358,mat...@we...:/home/groups/m/ma/matplotlib/htdocs/ -essh --cvs-exclude')
# we are now doing this in the doc/examples build
#os.system('cd ~/mpl/examples; svn-clean; cd ..; rsync -avz examples jdh2358,mat...@we...:/home/groups/m/ma/matplotlib/htdocs/ -essh --cvs-exclude --delete')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 18:01:21
|
Revision: 6247
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6247&view=rev
Author: jdh2358
Date: 2008-10-17 18:01:18 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
update horiz sidebar shot; take ii
Modified Paths:
--------------
trunk/matplotlib/doc/_static/logo_sidebar_horiz.png
Modified: trunk/matplotlib/doc/_static/logo_sidebar_horiz.png
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 17:53:02
|
Revision: 6246
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6246&view=rev
Author: jdh2358
Date: 2008-10-17 17:52:59 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
update horiz sidebar shot
Modified Paths:
--------------
trunk/matplotlib/doc/_static/logo_sidebar_horiz.png
Modified: trunk/matplotlib/doc/_static/logo_sidebar_horiz.png
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 17:46:12
|
Revision: 6245
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6245&view=rev
Author: jdh2358
Date: 2008-10-17 17:46:09 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
added horiz logo
Added Paths:
-----------
trunk/matplotlib/doc/_static/logo_sidebar_horiz.png
Added: trunk/matplotlib/doc/_static/logo_sidebar_horiz.png
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/doc/_static/logo_sidebar_horiz.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 17:22:03
|
Revision: 6244
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6244&view=rev
Author: jdh2358
Date: 2008-10-17 17:21:56 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
more faqs and codex example search keyword
Modified Paths:
--------------
trunk/matplotlib/doc/examples/gen_rst.py
trunk/matplotlib/doc/faq/howto_faq.rst
trunk/matplotlib/doc/faq/installing_faq.rst
trunk/matplotlib/doc/faq/troubleshooting_faq.rst
Modified: trunk/matplotlib/doc/examples/gen_rst.py
===================================================================
--- trunk/matplotlib/doc/examples/gen_rst.py 2008-10-17 16:03:23 UTC (rev 6243)
+++ trunk/matplotlib/doc/examples/gen_rst.py 2008-10-17 17:21:56 UTC (rev 6244)
@@ -114,7 +114,7 @@
contents = '\n'.join([' %s'%row.rstrip() for row in contents.split('\n')])
fh.write(contents)
- fh.write('\n\n')
+ fh.write('\n\nKeyword: codex (see :ref:`how-to-search-examples`)')
fh.close()
fhsubdirIndex.close()
Modified: trunk/matplotlib/doc/faq/howto_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 16:03:23 UTC (rev 6243)
+++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 17:21:56 UTC (rev 6244)
@@ -9,7 +9,7 @@
.. _howto-findobj:
-How do I find all the objects in my figure of a certain type?
+Find all objects in figure of a certain type
=============================================================
Every matplotlib artist (see :ref:`artist-tutorial`) has a method
@@ -35,7 +35,7 @@
.. _howto-transparent:
-How do I save transparent figures?
+Save transparent figures
==================================
The :meth:`~matplotlib.pyplot.savefig` command has a keyword argument
@@ -64,7 +64,7 @@
.. _howto-subplots-adjust:
-How do I move the edge of my axes area over to make room for my tick labels?
+Move the edge of an axes to make room for tick labels
============================================================================
For subplots, you can control the default spacing on the left, right,
@@ -114,7 +114,7 @@
.. _howto-auto-adjust:
-How do I automatically make room for my tick labels?
+Automatically make room for tick labels
====================================================
In most use cases, it is enough to simpy change the subplots adjust
@@ -148,7 +148,7 @@
.. _howto-ticks:
-How do I configure the tick linewidths?
+Configure the tick linewidths
=======================================
In matplotlib, the ticks are *markers*. All
@@ -174,7 +174,7 @@
.. _howto-align-label:
-How do I align my ylabels across multiple subplots?
+Align my ylabels across multiple subplots
===================================================
If you have multiple subplots over one another, and the y data have
@@ -191,7 +191,7 @@
.. _howto-webapp:
-How do I use matplotlib in a web application server?
+Matplotlib in a web application server
====================================================
Many users report initial problems trying to use maptlotlib in web
@@ -237,17 +237,17 @@
fig.savefig(sys.stdout)
-How do I use matplotlib with apache?
+matplotlib with apache
------------------------------------
TODO
-How do I use matplotlib with django?
+matplotlib with django
------------------------------------
TODO
-How do I use matplotlib with zope?
+matplotlib with zope
----------------------------------
TODO
@@ -255,7 +255,7 @@
.. _date-index-plots:
-How do I skip dates where there is no data?
+Skip dates where there is no data
===========================================
When plotting time series, eg financial time series, one often wants
@@ -292,7 +292,7 @@
.. _point-in-poly:
-How do I test whether a point is inside a polygon?
+Test whether a point is inside a polygon
==================================================
The :mod:`matplotlib.nxutils` provides two high performance methods:
@@ -340,7 +340,7 @@
.. _how-to-submit-patch:
-How do I submit a patch?
+Submit a patch
========================
First obtain a copy of matplotlib svn (see :ref:`install-svn`) and
@@ -370,6 +370,72 @@
:ref:`developers-guide-index`.
+.. _how-to-contribute-docs:
+
+Contribute to matplotlib documentation
+=========================================
+
+matplotlib is a big library, which is used in many ways, and the
+documentation we have only scratches the surface of everything it can
+do. So far, the place most people have learned all these features are
+through studying the examples (:ref:`how-to-search-examples`), which is a
+recommended and great way to learn, but it would be nice to have more
+official narrative documentation guiding people through all the dark
+corners. This is where you come in.
+
+There is a good chance you know more about matplotlib usage in some
+areas, the stuff you do every day, than any of the developers. *Just
+pulled your hair out compiling matplotlib for windows?* Write a FAQ or
+a section for the :ref:`installing` page. *Are you a digital signal
+processing wizard?* Write a tutorial on the signal analysis plotting
+functions like :func:`~matplotlib.pyplot.xcorr`,
+:func:`~matplotlib.pyplot.psd` and
+:func:`~matplotlib.pyplot.specgram`. *Do you use matplotlib with
+`django <ttp://www.djangoproject.com/>`_ or other popular web
+application servers?* Write a FAQ or tutorial and we'll find a place
+for it in the :ref:`users-guide-index`. *Bundle matplotlib in a `py2exe
+<http://www.py2exe.org/>`_ app?* ... I think you get the idea.
+
+matplotlib is documented using the `sphinx
+<http://sphinx.pocoo.org/index.html>`_ extensions to restructured text
+`ReST <http://docutils.sourceforge.net/rst.html>`_. sphinx is a
+extensible python framework for documentation projects which generates
+HTML and PDF, and is pretty easy to write; you can see the source for this
+document or any page on this site by clicking on *Show Source* link
+at the end of the page in the sidebar (or `here
+<../_sources/faq/howto_faq.txt>`_ for this document).
+
+The sphinx website is a good resource for learning sphinx, but we have
+put together a cheat-sheet at :ref:`documenting-matplotlib` which
+shows you how to get started, and outlines the matplotlib conventions
+and extensions, eg for including plots directly from external code in
+your documents.
+
+Once your documentation contributions are working (and hopefully
+tested by actually *building* the docs) you can submit them as a patch
+against svn. See :ref:`install-svn` and :ref:`how-to-submit-patch`.
+Looking for something to do? Search for ``TODO`` at :`search`.
+
+
+.. _how-to-search-examples:
+
+Search examples
+=========================================
+
+The nearly 300 code :ref:`examples-index` included with the matplotlib
+source distribution are full-text searchable from the :ref:`search`
+page, but sometimes when you search, you get a lot of results from the
+:ref:`api-index` or other documentation that you may not be interested in if
+you just want to find a complete, free-standing, working piece of
+example code. To facilitate example searches, we have tagged every
+page with the keyword ``codex`` for *code example* which shouldn't
+appear anywhere else on this site except in the FAQ and in every
+example. So if you want to search for an example that uses an ellipse,
+:ref:`search` for ``codex ellipse``.
+
+
+
+
.. _howto-click-maps:
Clickable images for HTML
@@ -385,7 +451,7 @@
.. _howto-set-zorder:
-How do I control the depth of plot elements?
+Control the depth of plot elements
=============================================
Within an axes, the order that the various lines, markers, text,
@@ -409,7 +475,7 @@
.. _howto-axis-equal:
-How to I make the aspect ratio for plots equal?
+Make the aspect ratio for plots equal
===============================================
The Axes property :meth:`matplotlib.axes.Axes.set_aspect` controls the
@@ -427,13 +493,13 @@
.. _howto-movie:
-How do I make a movie?
+Make a movie
======================
If you want to take an animated plot and turn it into a movie, the
best approach is to save a series of image files (eg PNG) and use an
-external tool to convert them to a movie. You can use ` mencoder
+external tool to convert them to a movie. You can use `mencoder
<http://www.mplayerhq.hu/DOCS/HTML/en/mencoder.html>`_,
which is part of the `mplayer <http://www.mplayerhq.hu>`_ suite
for this::
@@ -475,7 +541,7 @@
.. _howto-twoscale:
-Can I have multiple y-axis scales?
+Multiple y-axis scales
==================================
A frequent request is to have two scales for the left and right
@@ -514,10 +580,10 @@
See :ref:`api-two_scales` for a complete example
-.. _howto-batchmode:
+.. _howto-batch:
-Can I just generate images without having a window popup?
-=====================================================
+Generate images without having a window popup
+===========================================================
The easiest way to do this is use an image backend (see
:ref:`what-is-a-backend`) such as Agg (for PNGs), PDF, SVG or PS. In
@@ -535,21 +601,17 @@
.. seealso::
:ref:`howto-webapp`
- ('SHOW',
- "What's up with 'show'? Do I have to use it?",
- """
-
.. _howto-show
-How should I use :func:`~matplotlib.pyplot.show`?
-=================================================
+Use :func:`~matplotlib.pyplot.show`
+=====================================================
The user interface backends need to start the GUI mainloop, and this
is what :func:`~matplotlib.pyplot.show` does. It tells matplotlib to
raise all of the figure windows and start the mainloop. Because the
mainloop is blocking, you should only call this once per script, at
the end. If you are using matplotlib to generate images only and do
-not want a user interface window, you can skip it (see
+not want a user interface window, you do not need to call ``show`` (see
:ref:`howto-batch` and :ref:`what-is-a-backend`).
@@ -565,8 +627,8 @@
It is *possible* to force matplotlib to draw after every command,
which is what you usually want when working interactively at the
-python console, but in a script you want to defer all drawing until
-the script has executed (see :ref:`mpl-shell`). This is especially
+python console (see :ref:`mpl-shell`), but in a script you want to
+defer all drawing until the script has executed. This is especially
important for complex figures that take some time to draw.
:func:`~matplotlib.pyplot.show` is designed to tell matplotlib that
you're all done issuing commands and you want to draw the figure now.
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-10-17 16:03:23 UTC (rev 6243)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-10-17 17:21:56 UTC (rev 6244)
@@ -8,12 +8,12 @@
.. contents::
-How do I report a compilation problem?
+Report a compilation problem
======================================
See :ref:`reporting-problems`.
-matplotlib compiled fine, but I can't get anything to plot
+matplotlib compiled fine, but nothing shows up with plot
==========================================================
The first thing to try is a :ref:`clean install <clean-install>` and see if
@@ -42,7 +42,7 @@
.. _clean-install:
-How do I cleanly rebuild and reinstall everything?
+Cleanly rebuild and reinstall everything
==================================================
The steps depend on your platform and installation method.
@@ -93,7 +93,7 @@
.. _install-svn:
-How to install from svn?
+Install from svn
========================
Checking out the main source::
@@ -236,7 +236,7 @@
.. _pygtk-2.4:
-How do I compile matplotlib with PyGTK-2.4?
+Compile matplotlib with PyGTK-2.4
-------------------------------------------
There is a `bug in PyGTK-2.4`_. You need to edit
@@ -269,11 +269,11 @@
.. _easy-install-osx-egg:
-How can I easy_install my egg?
+easy_install from egg?
------------------------------
-I downloaded the egg for 0.98 from the matplotlib webpages,
-and I am trying to ``easy_install`` it, but I am getting an error::
+Some users have reported problems with the egg for 0.98 from the
+matplotlib download site, with ``easy_install``, getting an error::
> easy_install ./matplotlib-0.98.0-py2.5-macosx-10.3-fat.egg
Processing matplotlib-0.98.0-py2.5-macosx-10.3-fat.egg
@@ -296,7 +296,7 @@
.. _windows-installers:
-Where can I get binary installers for windows?
+Binary installers for windows
----------------------------------------------
If you have already installed python, you can use one of the
Modified: trunk/matplotlib/doc/faq/troubleshooting_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/troubleshooting_faq.rst 2008-10-17 16:03:23 UTC (rev 6243)
+++ trunk/matplotlib/doc/faq/troubleshooting_faq.rst 2008-10-17 17:21:56 UTC (rev 6244)
@@ -8,7 +8,7 @@
.. _matplotlib-version:
-What is my matplotlib version?
+Obtaining matplotlib version
==============================
To find out your matplotlib version number, import it and print the
@@ -21,8 +21,8 @@
.. _locating-matplotlib-install:
-Where is matplotlib installed?
-==============================
+:file:`matplotlib` install location
+====================================
You can find what directory matplotlib is installed in by importing it
and printing the ``__file__`` attribute::
@@ -33,8 +33,8 @@
.. _locating-matplotlib-config-dir:
-Where is my .matplotlib directory?
-==================================
+:file:`.matplotlib` directory location
+========================================
Each user has a :file:`.matplotlib/` directory which may contain a
:ref:`matplotlibrc <customizing-with-matplotlibrc-files>` file and various
@@ -61,11 +61,11 @@
.. _reporting-problems:
-How do I report a problem?
+Report a problem
==========================
If you are having a problem with matplotlib, search the mailing
-lists first: There's a good chance someone else has already run into
+lists first: there's a good chance someone else has already run into
your problem.
If not, please provide the following information in your e-mail to the
@@ -128,7 +128,7 @@
.. _svn-trouble:
-I am having trouble with a recent svn update, what should I do?
+Problems with recent svn versions
===============================================================
First make sure you have a clean build and install (see
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 16:03:33
|
Revision: 6243
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6243&view=rev
Author: jdh2358
Date: 2008-10-17 16:03:23 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
moved two scales example to api
Added Paths:
-----------
trunk/matplotlib/examples/api/two_scales.py
Removed Paths:
-------------
trunk/matplotlib/examples/pylab_examples/two_scales.py
Copied: trunk/matplotlib/examples/api/two_scales.py (from rev 6242, trunk/matplotlib/examples/pylab_examples/two_scales.py)
===================================================================
--- trunk/matplotlib/examples/api/two_scales.py (rev 0)
+++ trunk/matplotlib/examples/api/two_scales.py 2008-10-17 16:03:23 UTC (rev 6243)
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+"""
+
+Demonstrate how to do two plots on the same axes with different left
+right scales.
+
+
+The trick is to use *2 different axes*. Turn the axes rectangular
+frame off on the 2nd axes to keep it from obscuring the first.
+Manually set the tick locs and labels as desired. You can use
+separate matplotlib.ticker formatters and locators as desired since
+the two axes are independent.
+
+This is acheived in the following example by calling pylab's twinx()
+function, which performs this work. See the source of twinx() in
+pylab.py for an example of how to do it for different x scales. (Hint:
+use the xaxis instance and call tick_bottom and tick_top in place of
+tick_left and tick_right.)
+
+"""
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+ax1 = fig.add_subplot(111)
+t = np.arange(0.01, 10.0, 0.01)
+s1 = np.exp(t)
+ax1.plot(t, s1, 'b-')
+ax1.set_xlabel('time (s)')
+ax1.set_ylabel('exp')
+
+
+# turn off the 2nd axes rectangle with frameon kwarg
+ax2 = ax1.twinx()
+s2 = np.sin(2*np.pi*t)
+ax2.plot(t, s2, 'r.')
+ax2.set_ylabel('sin')
+plt.show()
+
Deleted: trunk/matplotlib/examples/pylab_examples/two_scales.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/two_scales.py 2008-10-17 16:02:52 UTC (rev 6242)
+++ trunk/matplotlib/examples/pylab_examples/two_scales.py 2008-10-17 16:03:23 UTC (rev 6243)
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-"""
-
-Demonstrate how to do two plots on the same axes with different left
-right scales.
-
-
-The trick is to use *2 different axes*. Turn the axes rectangular
-frame off on the 2nd axes to keep it from obscuring the first.
-Manually set the tick locs and labels as desired. You can use
-separate matplotlib.ticker formatters and locators as desired since
-the two axes are independent.
-
-This is acheived in the following example by calling pylab's twinx()
-function, which performs this work. See the source of twinx() in
-pylab.py for an example of how to do it for different x scales. (Hint:
-use the xaxis instance and call tick_bottom and tick_top in place of
-tick_left and tick_right.)
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax1 = fig.add_subplot(111)
-t = np.arange(0.01, 10.0, 0.01)
-s1 = np.exp(t)
-ax1.plot(t, s1, 'b-')
-ax1.set_xlabel('time (s)')
-ax1.set_ylabel('exp')
-
-
-# turn off the 2nd axes rectangle with frameon kwarg
-ax2 = ax1.twinx()
-s2 = np.sin(2*np.pi*t)
-ax2.plot(t, s2, 'r.')
-ax2.set_ylabel('sin')
-plt.show()
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 16:03:05
|
Revision: 6242
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6242&view=rev
Author: jdh2358
Date: 2008-10-17 16:02:52 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
updates to the FAQ
Modified Paths:
--------------
trunk/matplotlib/doc/faq/howto_faq.rst
trunk/matplotlib/examples/pylab_examples/two_scales.py
Modified: trunk/matplotlib/doc/faq/howto_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 15:35:05 UTC (rev 6241)
+++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 16:02:52 UTC (rev 6242)
@@ -470,4 +470,127 @@
.. htmlonly::
- See :ref:`animation-movie_demo` for a complete example.
+ Josh Lifton provided this example :ref:`animation-movie_demo`, which is possibly dated since it was written in 2004.
+
+
+.. _howto-twoscale:
+
+Can I have multiple y-axis scales?
+==================================
+
+A frequent request is to have two scales for the left and right
+y-axis, which is possible using :func:`~matplotlib.pyplot.twinx` (more
+than two scales are not currently supported, though it is on the wishq
+list). This works pretty well, though there are some quirks when you
+are trying to interactively pan and zoom, since both scales do not get
+the signals.
+
+The approach :func:`~matplotlib.pyplot.twinx` (and its sister
+:func:`~matplotlib.pyplot.twiny`) uses is to use *2 different axes*,
+turning the axes rectangular frame off on the 2nd axes to keep it from
+obscuring the first, and manually setting the tick locs and labels as
+desired. You can use separate matplotlib.ticker formatters and
+locators as desired since the two axes are independent::
+
+ import numpy as np
+ import matplotlib.pyplot as plt
+
+ fig = plt.figure()
+ ax1 = fig.add_subplot(111)
+ t = np.arange(0.01, 10.0, 0.01)
+ s1 = np.exp(t)
+ ax1.plot(t, s1, 'b-')
+ ax1.set_xlabel('time (s)')
+ ax1.set_ylabel('exp')
+
+ ax2 = ax1.twinx()
+ s2 = np.sin(2*np.pi*t)
+ ax2.plot(t, s2, 'r.')
+ ax2.set_ylabel('sin')
+ plt.show()
+
+
+.. htmlonly::
+
+ See :ref:`api-two_scales` for a complete example
+
+.. _howto-batchmode:
+
+Can I just generate images without having a window popup?
+=====================================================
+
+The easiest way to do this is use an image backend (see
+:ref:`what-is-a-backend`) such as Agg (for PNGs), PDF, SVG or PS. In
+your figure generating script, just place call
+:func:`matplotlib.use` directive before importing pylab or
+pyplot::
+
+ import matplotlib
+ matplotlib.use('Agg')
+ import matplotlib.pyplot as plt
+ plt.plot([1,2,3])
+ plt.savefig('myfig')
+
+
+.. seealso::
+ :ref:`howto-webapp`
+
+ ('SHOW',
+ "What's up with 'show'? Do I have to use it?",
+ """
+
+.. _howto-show
+
+How should I use :func:`~matplotlib.pyplot.show`?
+=================================================
+
+The user interface backends need to start the GUI mainloop, and this
+is what :func:`~matplotlib.pyplot.show` does. It tells matplotlib to
+raise all of the figure windows and start the mainloop. Because the
+mainloop is blocking, you should only call this once per script, at
+the end. If you are using matplotlib to generate images only and do
+not want a user interface window, you can skip it (see
+:ref:`howto-batch` and :ref:`what-is-a-backend`).
+
+
+Because it is expensive to draw, matplotlib does not want to redrawing the figure
+many times in a script such as the following::
+
+ plot([1,2,3]) # draw here ?
+ xlabel('time') # and here ?
+ ylabel('volts') # and here ?
+ title('a simple plot') # and here ?
+ show()
+
+
+It is *possible* to force matplotlib to draw after every command,
+which is what you usually want when working interactively at the
+python console, but in a script you want to defer all drawing until
+the script has executed (see :ref:`mpl-shell`). This is especially
+important for complex figures that take some time to draw.
+:func:`~matplotlib.pyplot.show` is designed to tell matplotlib that
+you're all done issuing commands and you want to draw the figure now.
+
+.. note::
+
+ :func:`~matplotlib.pyplot.show` should be called at most once per
+ script and it should be the last line of your script. At that
+ point, the GUI takes control of the interpreter. If you want to
+ force a figure draw, use :func:`~matplotlib.pyplot.draw` instead.
+
+Many users are frustrated by show because they want it to be a
+blocking call that raises the figure, pauses the script until the
+figure is closed, and then allows the script to continue running until
+the next figure is created and the next show is made. Something like
+this::
+
+ # WARNING : illustrating how NOT to use show
+ for i in range(10):
+ # make figure i
+ show()
+
+This is not what show does and unfortunately, because doing blocking
+calls across user interfaces can be tricky, is currently unsupported,
+though we have made some pregress towards supporting blocking events.
+
+
Modified: trunk/matplotlib/examples/pylab_examples/two_scales.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/two_scales.py 2008-10-17 15:35:05 UTC (rev 6241)
+++ trunk/matplotlib/examples/pylab_examples/two_scales.py 2008-10-17 16:02:52 UTC (rev 6242)
@@ -19,20 +19,22 @@
"""
-from pylab import *
+import numpy as np
+import matplotlib.pyplot as plt
-ax1 = subplot(111)
-t = arange(0.01, 10.0, 0.01)
-s1 = exp(t)
-plot(t, s1, 'b-')
-xlabel('time (s)')
-ylabel('exp')
+fig = plt.figure()
+ax1 = fig.add_subplot(111)
+t = np.arange(0.01, 10.0, 0.01)
+s1 = np.exp(t)
+ax1.plot(t, s1, 'b-')
+ax1.set_xlabel('time (s)')
+ax1.set_ylabel('exp')
# turn off the 2nd axes rectangle with frameon kwarg
-ax2 = twinx()
-s2 = sin(2*pi*t)
-plot(t, s2, 'r.')
-ylabel('sin')
-ax2.yaxis.tick_right()
-show()
+ax2 = ax1.twinx()
+s2 = np.sin(2*np.pi*t)
+ax2.plot(t, s2, 'r.')
+ax2.set_ylabel('sin')
+plt.show()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 15:35:15
|
Revision: 6241
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6241&view=rev
Author: jdh2358
Date: 2008-10-17 15:35:05 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
added joshuas movie demo
Modified Paths:
--------------
trunk/matplotlib/doc/faq/howto_faq.rst
trunk/matplotlib/doc/faq/installing_faq.rst
Added Paths:
-----------
trunk/matplotlib/examples/animation/animation_blit_gtk.py
trunk/matplotlib/examples/animation/movie_demo.py
Removed Paths:
-------------
trunk/matplotlib/examples/animation/animation_blit.py
Modified: trunk/matplotlib/doc/faq/howto_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 14:31:38 UTC (rev 6240)
+++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 15:35:05 UTC (rev 6241)
@@ -299,7 +299,7 @@
for a single point use :func:`~matplotlib.nxutils.pnpoly` and for an
array of points use :func:`~matplotlib.nxutils.points_inside_poly`.
For a discussion of the implementation see `pnpoly
-<http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html>`_.
+<http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html>`_.
.. sourcecode:: ipython
@@ -334,5 +334,140 @@
Out[32]: array([False, False, False, False, False, False, False, True, False, True], dtype=bool)
.. htmlonly::
-
+
For a complete example, see :ref:`event_handling-lasso_demo`.
+
+
+.. _how-to-submit-patch:
+
+How do I submit a patch?
+========================
+
+First obtain a copy of matplotlib svn (see :ref:`install-svn`) and
+make your changes to the matplotlib source code or documentation and
+apply a `svn diff`. If it is feasible, do your diff from the top
+level directory, the one that contains :file:`setup.py`. Eg,::
+
+ > cd /path/to/matplotlib/source
+ > svn diff > mypatch.diff
+
+and then post your patch to the `matplotlib-devel
+<http://sourceforge.net/mail/?group_id=80706>`_ mailing list. If you
+do not get a response within 24 hours, post your patch to the
+sourceforge patch `tracker
+<http://sourceforge.net/tracker2/?atid=560722&group_id=80706&func=browse>`_,
+and follow up on the mailing list with a link to the sourceforge patch
+submissions. If you still do not hear anything within a week (this
+shouldn't happen!), send us a kind and gentle reminder on the mailing
+list.
+
+If you have made lots of local changes and do not want to a diff
+against the entire tree, but rather against a single directory or
+file, that is fine, but we do prefer svn diffs against HEAD.
+
+You should check out the guide to developing matplotlib to make sure
+your patch abides by our coding conventions
+:ref:`developers-guide-index`.
+
+
+.. _howto-click-maps:
+
+Clickable images for HTML
+=========================
+
+Andrew Dalke of `Dalke Scientific <http://www.dalkescientific.com>`_
+has written a nice `article
+<http://www.dalkescientific.com/writings/diary/archive/2005/04/24/interactive_html.html>`_
+on how to make html click maps with matplotlib agg PNGs. We would
+also like to add this functionality to SVG and add a SWF backend to
+support these kind of images. If you are interested in contributing
+to these efforts that would be great.
+
+.. _howto-set-zorder:
+
+How do I control the depth of plot elements?
+=============================================
+
+Within an axes, the order that the various lines, markers, text,
+collections, etc appear is determined by the
+:meth:`matplotlib.artist.Artist.set_zorder` property. The default
+order is patches, lines, text, with collections of lines and
+collections of patches appearing at the same level as regular lines
+and patches, respectively::
+
+ line, = ax.plot(x, y, zorder=10)
+
+
+
+.. htmlonly::
+
+ See :ref:`pylab_examples-zorder_demo` for a complete example.
+
+You can also use the Axes property
+:meth:`matplotlib.axes.Axes.set_axisbelow` to control whether the grid
+lines are placed above or below your other plot elements.
+
+.. _howto-axis-equal:
+
+How to I make the aspect ratio for plots equal?
+===============================================
+
+The Axes property :meth:`matplotlib.axes.Axes.set_aspect` controls the
+aspect ratio of the axes. You can set it to be 'auto', 'equal', or
+some ratio which controls the ratio::
+
+ ax = fig.add_subplot(111, aspect='equal')
+
+
+
+.. htmlonly::
+
+ See :ref:`pylab_examples-equal_aspect_ratio` for a complete example.
+
+
+.. _howto-movie:
+
+How do I make a movie?
+======================
+
+
+If you want to take an animated plot and turn it into a movie, the
+best approach is to save a series of image files (eg PNG) and use an
+external tool to convert them to a movie. You can use ` mencoder
+<http://www.mplayerhq.hu/DOCS/HTML/en/mencoder.html>`_,
+which is part of the `mplayer <http://www.mplayerhq.hu>`_ suite
+for this::
+
+
+ #fps (frames per second) controls the play speed
+ mencoder 'mf://*.png' -mf type=png:fps=10 -ovc \\
+ lavc -lavcopts vcodec=wmv2 -oac copy -o animation.avi
+
+The swiss army knife of image tools, ImageMagick's `convert
+<http://www.imagemagick.org/script/convert.php>`_ works for this as
+well.<p>
+
+Here is a simple example script that saves some PNGs, makes them into
+a movie, and then cleans up::
+
+ import os, sys
+ import matplotlib.pyplot as plt
+
+ files = []
+ fig = plt.figure(figsize=(5,5))
+ ax = fig.add_subplot(111)
+ for i in range(50): # 50 frames
+ ax.cla()
+ ax.imshow(rand(5,5), interpolation='nearest')
+ fname = '_tmp%03d.png'%i
+ print 'Saving frame', fname
+ fig.savefig(fname)
+ files.append(fname)
+
+ print 'Making movie animation.mpg - this make take a while'
+ os.system("mencoder 'mf://_tmp*.png' -mf type=png:fps=10 \\
+ -ovc lavc -lavcopts vcodec=wmv2 -oac copy -o animation.mpg")
+
+.. htmlonly::
+
+ See :ref:`animation-movie_demo` for a complete example.
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-10-17 14:31:38 UTC (rev 6240)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-10-17 15:35:05 UTC (rev 6241)
@@ -105,6 +105,8 @@
> cd matplotlib
> python setup.py install
+
+
Backends
========
Deleted: trunk/matplotlib/examples/animation/animation_blit.py
===================================================================
--- trunk/matplotlib/examples/animation/animation_blit.py 2008-10-17 14:31:38 UTC (rev 6240)
+++ trunk/matplotlib/examples/animation/animation_blit.py 2008-10-17 15:35:05 UTC (rev 6241)
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-
-# For detailed comments on animation and the techniques used here, see
-# the wiki entry
-# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
-import sys
-import time
-
-import gtk, gobject
-
-import matplotlib
-matplotlib.use('GTKAgg')
-import numpy as npy
-import pylab as p
-
-
-ax = p.subplot(111)
-canvas = ax.figure.canvas
-
-p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
-p.grid() # to ensure proper background restore
-
-# create the initial line
-x = npy.arange(0,2*npy.pi,0.01)
-line, = p.plot(x, npy.sin(x), animated=True, lw=2)
-
-# for profiling
-tstart = time.time()
-
-def update_line(*args):
- if update_line.background is None:
- update_line.background = canvas.copy_from_bbox(ax.bbox)
-
- # restore the clean slate background
- canvas.restore_region(update_line.background)
- # update the data
- line.set_ydata(npy.sin(x+update_line.cnt/10.0))
- # just draw the animated artist
- try:
- ax.draw_artist(line)
- except AssertionError:
- return
- # just redraw the axes rectangle
- canvas.blit(ax.bbox)
-
- if update_line.cnt==1000:
- # print the timing info and quit
- print 'FPS:' , 1000/(time.time()-tstart)
- sys.exit()
-
- update_line.cnt += 1
- return True
-
-update_line.cnt = 0
-update_line.background = None
-gobject.idle_add(update_line)
-p.show()
Copied: trunk/matplotlib/examples/animation/animation_blit_gtk.py (from rev 6240, trunk/matplotlib/examples/animation/animation_blit.py)
===================================================================
--- trunk/matplotlib/examples/animation/animation_blit_gtk.py (rev 0)
+++ trunk/matplotlib/examples/animation/animation_blit_gtk.py 2008-10-17 15:35:05 UTC (rev 6241)
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# For detailed comments on animation and the techniques used here, see
+# the wiki entry
+# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
+import time
+
+import gtk, gobject
+
+import matplotlib
+matplotlib.use('GTKAgg')
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+canvas = fig.canvas
+
+fig.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
+ax.grid() # to ensure proper background restore
+
+# create the initial line
+x = np.arange(0,2*np.pi,0.01)
+line, = ax.plot(x, np.sin(x), animated=True, lw=2)
+canvas.draw()
+
+# for profiling
+tstart = time.time()
+
+def update_line(*args):
+ print 'you are here', update_line.cnt
+ if update_line.background is None:
+ update_line.background = canvas.copy_from_bbox(ax.bbox)
+
+ # restore the clean slate background
+ canvas.restore_region(update_line.background)
+ # update the data
+ line.set_ydata(np.sin(x+update_line.cnt/10.0))
+ # just draw the animated artist
+ ax.draw_artist(line)
+
+ # just redraw the axes rectangle
+ canvas.blit(ax.bbox)
+
+ if update_line.cnt==1000:
+ # print the timing info and quit
+ print 'FPS:' , 1000/(time.time()-tstart)
+ gtk.mainquit()
+ raise SystemExit
+
+ update_line.cnt += 1
+ return True
+
+update_line.cnt = 0
+update_line.background = None
+
+
+def start_anim(event):
+ gobject.idle_add(update_line)
+ canvas.mpl_disconnect(start_anim.cid)
+
+start_anim.cid = canvas.mpl_connect('draw_event', start_anim)
+
+
+
+plt.show()
Added: trunk/matplotlib/examples/animation/movie_demo.py
===================================================================
--- trunk/matplotlib/examples/animation/movie_demo.py (rev 0)
+++ trunk/matplotlib/examples/animation/movie_demo.py 2008-10-17 15:35:05 UTC (rev 6241)
@@ -0,0 +1,140 @@
+#!/usr/bin/python
+#
+# Josh Lifton 2004
+#
+# Permission is hereby granted to use and abuse this document
+# so long as proper attribution is given.
+#
+# This Python script demonstrates how to use the numarray package
+# to generate and handle large arrays of data and how to use the
+# matplotlib package to generate plots from the data and then save
+# those plots as images. These images are then stitched together
+# by Mencoder to create a movie of the plotted data. This script
+# is for demonstration purposes only and is not intended to be
+# for general use. In particular, you will likely need to modify
+# the script to suit your own needs.
+#
+
+
+from matplotlib.matlab import * # For plotting graphs.
+import os # For issuing commands to the OS.
+import sys # For determining the Python version.
+
+#
+# Print the version information for the machine, OS,
+# Python interpreter, and matplotlib. The version of
+# Mencoder is printed when it is called.
+#
+# This script is known to have worked for:
+#
+# OS version: ('Linux', 'flux-capacitor', '2.4.26', '#1 SMP Sa Apr 17 19:33:42 CEST 2004', 'i686')
+# Python version: 2.3.4 (#2, May 29 2004, 03:31:27) [GCC 3.3.3 (Debian 20040417)]
+# matplotlib version: 0.61.0
+# MEncoder version:
+# MEncoder 1.0pre4-3.3.3 (C) 2000-2004 MPlayer Team
+# CPU: Intel Celeron 2/Pentium III Coppermine,Geyserville 996.1 MHz (Family: 6, Stepping: 10)
+# Detected cache-line size is 32 bytes
+# CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0
+# Compiled for x86 CPU with extensions: MMX MMX2 SSE
+#
+print 'Executing on', os.uname()
+print 'Python version', sys.version
+print 'matplotlib version', matplotlib.__version__
+
+
+
+#
+# First, let's create some data to work with. In this example
+# we'll use a normalized Gaussian waveform whose mean and
+# standard deviation both increase linearly with time. Such a
+# waveform can be thought of as a propagating system that loses
+# coherence over time, as might happen to the probability
+# distribution of a clock subjected to independent, identically
+# distributed Gaussian noise at each time step.
+#
+
+print 'Initializing data set...' # Let the user know what's happening.
+
+# Initialize variables needed to create and store the example data set.
+numberOfTimeSteps = 100 # Number of frames we want in the movie.
+x = arange(-10,10,0.01) # Values to be plotted on the x-axis.
+mean = -6 # Initial mean of the Gaussian.
+stddev = 0.2 # Initial standard deviation.
+meaninc = 0.1 # Mean increment.
+stddevinc = 0.1 # Standard deviation increment.
+
+# Create an array of zeros and fill it with the example data.
+y = zeros((numberOfTimeSteps,len(x)), Float64)
+for i in range(numberOfTimeSteps) :
+ y[i] = (1/sqrt(2*pi*stddev))*exp(-((x-mean)**2)/(2*stddev))
+ mean = mean + meaninc
+ stddev = stddev + stddevinc
+
+print 'Done.' # Let the user know what's happening.
+
+#
+# Now that we have an example data set (x,y) to work with, we can
+# start graphing it and saving the images.
+#
+
+for i in range(len(y)) :
+ #
+ # The next four lines are just like Matlab.
+ #
+ plot(x,y[i],'b.')
+ axis((x[0],x[-1],-0.25,1))
+ xlabel('time (ms)')
+ ylabel('probability density function')
+
+ #
+ # Notice the use of LaTeX-like markup.
+ #
+ title(r'$\cal{N}(\mu, \sigma^2)$', fontsize=20)
+
+ #
+ # The file name indicates how the image will be saved and the
+ # order it will appear in the movie. If you actually wanted each
+ # graph to be displayed on the screen, you would include commands
+ # such as show() and draw() here. See the matplotlib
+ # documentation for details. In this case, we are saving the
+ # images directly to a file without displaying them.
+ #
+ filename = str('%03d' % i) + '.png'
+ savefig(filename, dpi=100)
+
+ #
+ # Let the user know what's happening.
+ #
+ print 'Wrote file', filename
+
+ #
+ # Clear the figure to make way for the next image.
+ #
+ clf()
+
+#
+# Now that we have graphed images of the dataset, we will stitch them
+# together using Mencoder to create a movie. Each image will become
+# a single frame in the movie.
+#
+# We want to use Python to make what would normally be a command line
+# call to Mencoder. Specifically, the command line call we want to
+# emulate is (without the initial '#'):
+# mencoder mf://*.png -mf type=png:w=800:h=600:fps=25 -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o output.avi
+# See the MPlayer and Mencoder documentation for details.
+#
+
+command = ('mencoder',
+ 'mf://*.png',
+ '-mf',
+ 'type=png:w=800:h=600:fps=25',
+ '-ovc',
+ 'lavc',
+ '-lavcopts',
+ 'vcodec=mpeg4',
+ '-oac',
+ 'copy',
+ '-o',
+ 'output.avi')
+
+os.spawnvp(os.P_WAIT, 'mencoder', command)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 14:31:50
|
Revision: 6240
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6240&view=rev
Author: jdh2358
Date: 2008-10-17 14:31:38 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
updates to nxutils docstrings
Modified Paths:
--------------
trunk/matplotlib/src/nxutils.c
Modified: trunk/matplotlib/src/nxutils.c
===================================================================
--- trunk/matplotlib/src/nxutils.c 2008-10-17 14:27:28 UTC (rev 6239)
+++ trunk/matplotlib/src/nxutils.c 2008-10-17 14:31:38 UTC (rev 6240)
@@ -221,17 +221,17 @@
{"pnpoly", pnpoly, METH_VARARGS,
"inside = pnpoly(x, y, xyverts)\n\n"
"Return 1 if x,y is inside the polygon, 0 otherwise.\n\n"
- "xyverts is a sequence of x,y vertices.\n\n"
+ "*xyverts*\n a sequence of x,y vertices.\n\n"
"A point on the boundary may be treated as inside or outside.\n"
- "See http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html"},
+ "See `pnpoly <http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html>`_"},
{"points_inside_poly", points_inside_poly, METH_VARARGS,
"mask = points_inside_poly(xypoints, xyverts)\n\n"
"Return a boolean ndarray, True for points inside the polygon.\n\n"
- "xypoints is a sequence of N x,y pairs.\n"
- "xyverts is a sequence of x,y vertices of the polygon.\n"
- "mask is an ndarray of length N.\n\n"
+ "*xypoints*\n a sequence of N x,y pairs.\n"
+ "*xyverts*\n sequence of x,y vertices of the polygon.\n"
+ "*mask* an ndarray of length N.\n\n"
"A point on the boundary may be treated as inside or outside.\n"
- "See http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html"},
+ "See `pnpoly <http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html>`_\n"},
{NULL} /* Sentinel */
};
@@ -241,7 +241,7 @@
PyObject* m;
m = Py_InitModule3("nxutils", module_methods,
- "general purpose utilities (numpy).");
+ "general purpose numerical utilities, eg for computational geometry, that are not available in `numpy <http://numpy.scipy.org>`_");
if (m == NULL)
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-17 14:27:46
|
Revision: 6238
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6238&view=rev
Author: jdh2358
Date: 2008-10-17 14:27:26 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
added nxutils and pnpoly faq
Modified Paths:
--------------
trunk/matplotlib/doc/api/nxutils_api.rst
trunk/matplotlib/doc/contents.rst
trunk/matplotlib/doc/faq/howto_faq.rst
Modified: trunk/matplotlib/doc/api/nxutils_api.rst
===================================================================
--- trunk/matplotlib/doc/api/nxutils_api.rst 2008-10-17 13:47:09 UTC (rev 6237)
+++ trunk/matplotlib/doc/api/nxutils_api.rst 2008-10-17 14:27:26 UTC (rev 6238)
@@ -1,3 +1,4 @@
+
*******************
matplotlib nxutils
*******************
@@ -2,12 +3,5 @@
-The nxutils are numerical utilities written in C, mainly to support
-computational gemoetry that is not in `numpy <http://numpy.scipy.org>`_.
-
-
:mod:`matplotlib.nxutils`
===========================
.. automodule:: matplotlib.nxutils
- :members:
- :undoc-members:
- :show-inheritance:
Modified: trunk/matplotlib/doc/contents.rst
===================================================================
--- trunk/matplotlib/doc/contents.rst 2008-10-17 13:47:09 UTC (rev 6237)
+++ trunk/matplotlib/doc/contents.rst 2008-10-17 14:27:26 UTC (rev 6238)
@@ -20,6 +20,7 @@
api/index.rst
glossary/index.rst
+
.. htmlonly::
examples/index.rst
Modified: trunk/matplotlib/doc/faq/howto_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 13:47:09 UTC (rev 6237)
+++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-10-17 14:27:26 UTC (rev 6238)
@@ -335,4 +335,4 @@
.. htmlonly::
- For a complete example, see :ref:`_event_handling-lasso_demo`.
+ For a complete example, see :ref:`event_handling-lasso_demo`.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mme...@us...> - 2008-10-17 14:27:35
|
Revision: 6239
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6239&view=rev
Author: mmetz_bn
Date: 2008-10-17 14:27:28 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
minor hist and hist docs updates
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-10-17 14:27:26 UTC (rev 6238)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-10-17 14:27:28 UTC (rev 6239)
@@ -6183,9 +6183,10 @@
Keyword arguments:
*bins*:
- 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. Note, if *bins*
+ Either an integer number of bins or a sequence giving the
+ bins. *x* are the data to be binned. *x* can be an array,
+ a 2D array with multiple data in its columns, or a list of
+ arrays with data of different length. Note, if *bins*
is an integer input argument=numbins, *bins* + 1 bin edges
will be returned, compatible with the semantics of
:func:`numpy.histogram` with the *new* = True argument.
@@ -6211,7 +6212,7 @@
gives the counts in that bin plus all bins for smaller values.
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. If *cumulative* evaluates to less than 0
+ last bin equals 1. If *cumulative* evaluates to less than 0
(e.g. -1), the direction of accumulation is reversed. In this
case, if *normed* is also *True*, then the histogram is normalized
such that the first bin equals 1.
@@ -6219,13 +6220,14 @@
*histtype*: [ 'bar' | 'barstacked' | 'step' | 'stepfilled' ]
The type of histogram to draw.
- - 'bar' is a traditional bar-type histogram
+ - 'bar' is a traditional bar-type histogram. If multiple data
+ are given the bars are aranged side by side.
- 'barstacked' is a bar-type histogram where multiple
- data are stacked on top of each other.
+ data are stacked on top of each other.
- 'step' generates a lineplot that is by default
- unfilled
+ unfilled.
- 'stepfilled' generates a lineplot that is by default
filled.
@@ -6233,9 +6235,9 @@
*align*: ['left' | 'mid' | 'right' ]
Controls how the histogram is plotted.
- - 'left': bars are centered on the left bin edges
+ - 'left': bars are centered on the left bin edges.
- - 'mid': bars are centered between the bin edges
+ - 'mid': bars are centered between the bin edges.
- 'right': bars are centered on the right bin edges.
@@ -6245,9 +6247,9 @@
the left edges.
*rwidth*:
- the relative width of the bars as a fraction of the bin
+ The relative width of the bars as a fraction of the bin
width. If *None*, automatically compute the width. Ignored
- if *histtype* = 'step'.
+ if *histtype* = 'step' or 'stepfilled'.
*log*:
If *True*, the histogram axis will be set to a log scale.
@@ -6280,7 +6282,8 @@
'hist now uses the rwidth to give relative width and not absolute width')
try:
- x = np.transpose(np.asarray(x).copy())
+ # make sure a copy is created: don't use asarray
+ x = np.transpose(np.array(x))
if len(x.shape)==1:
x.shape = (1,x.shape[0])
elif len(x.shape)==2 and x.shape[1]<x.shape[0]:
@@ -6290,7 +6293,7 @@
if iterable(x[0]) and not is_string_like(x[0]):
tx = []
for i in xrange(len(x)):
- tx.append( np.asarray(x[i]).copy() )
+ tx.append( np.array(x[i]) )
x = tx
n = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|