You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
| 2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
| 2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
| 2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jd...@us...> - 2008-10-14 21:17:41
|
Revision: 6188
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6188&view=rev
Author: jdh2358
Date: 2008-10-14 21:17:37 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
added sidebar for web docs
Added Paths:
-----------
trunk/matplotlib/doc/_static/logo_sidebar.png
Added: trunk/matplotlib/doc/_static/logo_sidebar.png
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/doc/_static/logo_sidebar.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-14 21:16:59
|
Revision: 6187
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6187&view=rev
Author: jdh2358
Date: 2008-10-14 21:16:51 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
preparing to move entire web site to sphinx; things may be whacked for a day or so
Modified Paths:
--------------
trunk/matplotlib/doc/api/index.rst
trunk/matplotlib/doc/conf.py
trunk/matplotlib/doc/devel/transformations.rst
trunk/matplotlib/doc/matplotlibrc
trunk/matplotlib/doc/pyplots/matplotlibrc
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_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/index.rst
Added Paths:
-----------
trunk/matplotlib/doc/_static/logo2.png
trunk/matplotlib/doc/_templates/index.html
trunk/matplotlib/doc/_templates/indexsidebar.html
trunk/matplotlib/doc/_templates/layout.html
trunk/matplotlib/doc/api/path_api.rst
trunk/matplotlib/doc/pyplots/colours.py
trunk/matplotlib/doc/pyplots/screenshots_barchart_demo.py
trunk/matplotlib/doc/pyplots/screenshots_date_demo.py
trunk/matplotlib/doc/pyplots/screenshots_ellipse_demo.py
trunk/matplotlib/doc/pyplots/screenshots_fill_demo.py
trunk/matplotlib/doc/pyplots/screenshots_histogram_demo.py
trunk/matplotlib/doc/pyplots/screenshots_path_patch_demo.py
trunk/matplotlib/doc/pyplots/screenshots_pie_demo.py
trunk/matplotlib/doc/pyplots/screenshots_scatter_demo.py
trunk/matplotlib/doc/pyplots/screenshots_simple_plots.py
trunk/matplotlib/doc/pyplots/screenshots_slider_demo.py
trunk/matplotlib/doc/pyplots/screenshots_subplot_demo.py
trunk/matplotlib/doc/pyplots/screenshots_table_demo.py
trunk/matplotlib/doc/users/screenshots.rst
Added: trunk/matplotlib/doc/_static/logo2.png
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/doc/_static/logo2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/matplotlib/doc/_templates/index.html
===================================================================
--- trunk/matplotlib/doc/_templates/index.html (rev 0)
+++ trunk/matplotlib/doc/_templates/index.html 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,1141 @@
+{% extends "layout.html" %}
+{% set title = 'Overview' %}
+{% block body %}
+ <h1>Welcome</h1>
+
+ matplotlib is a python 2D plotting library which produces
+ publication quality figures in a variety of hardcopy formats and
+ interactive environments across platforms. matplotlib can be used
+ in python scripts, the python and <a
+ href=http://ipython.scipy.org>ipython</a> shell (ala matlab or
+ mathematica), web application servers, and six graphical user
+ interface toolkits. <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 make a histogram of data in x, you simply need to type
+
+ <pre>
+ >>> hist(x, 100) # use 100 bins
+ </pre>
+
+ 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. A
+ summary of the goals of matplotlib and the progress so far can be
+ found <a href=goals.html>here</a>.<p>
+
+ The plotting functions in the <a href=api/pyplot_api.html>pyplot
+ interface</a> have a high degree of Matlab® compatibility.<p>
+
+ <br>
+ <table border=1 cellpadding=3 cellspacing=2>
+ <caption><h3>Plotting commands</h3></caption>
+ <tr><th>Function</th><th>Description</th></tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.acorr>acorr</a>
+
+ </th>
+
+ <td align="left">
+ plot the autocorrelation function
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.annotate>annotate</a>
+
+ </th>
+
+ <td align="left">
+ annotate something in the figure
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.arrow>arrow</a>
+
+ </th>
+
+ <td align="left">
+ add an arrow to the axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.axes>axes</a>
+
+ </th>
+
+ <td align="left">
+ Create a new axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.axhline>axhline</a>
+
+ </th>
+
+ <td align="left">
+ draw a horizontal line across axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.axvline>axvline</a>
+
+ </th>
+
+ <td align="left">
+ draw a vertical line across axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.axhspan>axhspan</a>
+
+ </th>
+
+ <td align="left">
+ draw a horizontal bar across axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.axvspan>axvspan</a>
+
+ </th>
+
+ <td align="left">
+ draw a vertical bar across axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.axis>axis</a>
+
+ </th>
+
+ <td align="left">
+ Set or return the current axis limits
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.bar>bar</a>
+
+ </th>
+
+ <td align="left">
+ make a bar chart
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.barh>barh</a>
+
+ </th>
+
+ <td align="left">
+ a horizontal bar chart
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.broken_barh>broken_barh</a>
+
+ </th>
+
+ <td align="left">
+ a set of horizontal bars with gaps
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.box>box</a>
+
+ </th>
+
+ <td align="left">
+ set the axes frame on/off state
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.boxplot>boxplot</a>
+
+ </th>
+
+ <td align="left">
+ make a box and whisker plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.cla>cla</a>
+
+ </th>
+
+ <td align="left">
+ clear current axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.clabel>clabel</a>
+
+ </th>
+
+ <td align="left">
+ label a contour plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.clf>clf</a>
+
+ </th>
+
+ <td align="left">
+ clear a figure window
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.clim>clim</a>
+
+ </th>
+
+ <td align="left">
+ adjust the color limits of the current image
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.close>close</a>
+
+ </th>
+
+ <td align="left">
+ close a figure window
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.colorbar>colorbar</a>
+
+ </th>
+
+ <td align="left">
+ add a colorbar to the current figure
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.cohere>cohere</a>
+
+ </th>
+
+ <td align="left">
+ make a plot of coherence
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.contour>contour</a>
+
+ </th>
+
+ <td align="left">
+ make a contour plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.contourf>contourf</a>
+
+ </th>
+
+ <td align="left">
+ make a filled contour plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.csd>csd</a>
+
+ </th>
+
+ <td align="left">
+ make a plot of cross spectral density
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.delaxes>delaxes</a>
+
+ </th>
+
+ <td align="left">
+ delete an axes from the current figure
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.draw>draw</a>
+
+ </th>
+
+ <td align="left">
+ Force a redraw of the current figure
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.errorbar>errorbar</a>
+
+ </th>
+
+ <td align="left">
+ make an errorbar graph
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.figlegend>figlegend</a>
+
+ </th>
+
+ <td align="left">
+ make legend on the figure rather than the axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.figimage>figimage</a>
+
+ </th>
+
+ <td align="left">
+ make a figure image
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.figtext>figtext</a>
+
+ </th>
+
+ <td align="left">
+ add text in figure coords
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.figure>figure</a>
+
+ </th>
+
+ <td align="left">
+ create or change active figure
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.fill>fill</a>
+
+ </th>
+
+ <td align="left">
+ make filled polygons
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.findobj>findobj</a>
+
+ </th>
+
+ <td align="left">
+ recursively find all objects matching some criteria
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.gca>gca</a>
+
+ </th>
+
+ <td align="left">
+ return the current axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.gcf>gcf</a>
+
+ </th>
+
+ <td align="left">
+ return the current figure
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.gci>gci</a>
+
+ </th>
+
+ <td align="left">
+ get the current image, or None
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.getp>getp</a>
+
+ </th>
+
+ <td align="left">
+ get a handle graphics property
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.grid>grid</a>
+
+ </th>
+
+ <td align="left">
+ set whether gridding is on
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.hist>hist</a>
+
+ </th>
+
+ <td align="left">
+ make a histogram
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.hold>hold</a>
+
+ </th>
+
+ <td align="left">
+ set the axes hold state
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.ioff>ioff</a>
+
+ </th>
+
+ <td align="left">
+ turn interaction mode off
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.ion>ion</a>
+
+ </th>
+
+ <td align="left">
+ turn interaction mode on
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.isinteractive>isinteractive</a>
+
+ </th>
+
+ <td align="left">
+ return True if interaction mode is on
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.imread>imread</a>
+
+ </th>
+
+ <td align="left">
+ load image file into array
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.imshow>imshow</a>
+
+ </th>
+
+ <td align="left">
+ plot image data
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.ishold>ishold</a>
+
+ </th>
+
+ <td align="left">
+ return the hold state of the current axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.legend>legend</a>
+
+ </th>
+
+ <td align="left">
+ make an axes legend
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.loglog>loglog</a>
+
+ </th>
+
+ <td align="left">
+ a log log plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.matshow>matshow</a>
+
+ </th>
+
+ <td align="left">
+ display a matrix in a new figure preserving aspect
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.pcolor>pcolor</a>
+
+ </th>
+
+ <td align="left">
+ make a pseudocolor plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.pcolormesh>pcolormesh</a>
+
+ </th>
+
+ <td align="left">
+ make a pseudocolor plot using a quadrilateral mesh
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.pie>pie</a>
+
+ </th>
+
+ <td align="left">
+ make a pie chart
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.plot>plot</a>
+
+ </th>
+
+ <td align="left">
+ make a line plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.plot_date>plot_date</a>
+
+ </th>
+
+ <td align="left">
+ plot dates
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.plotfile>plotfile</a>
+
+ </th>
+
+ <td align="left">
+ plot column data from an ASCII tab/space/comma delimited file
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.pie>pie</a>
+
+ </th>
+
+ <td align="left">
+ pie charts
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.polar>polar</a>
+
+ </th>
+
+ <td align="left">
+ make a polar plot on a PolarAxes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.psd>psd</a>
+
+ </th>
+
+ <td align="left">
+ make a plot of power spectral density
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.quiver>quiver</a>
+
+ </th>
+
+ <td align="left">
+ make a direction field (arrows) plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.rc>rc</a>
+
+ </th>
+
+ <td align="left">
+ control the default params
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.rgrids>rgrids</a>
+
+ </th>
+
+ <td align="left">
+ customize the radial grids and labels for polar
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.savefig>savefig</a>
+
+ </th>
+
+ <td align="left">
+ save the current figure
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.scatter>scatter</a>
+
+ </th>
+
+ <td align="left">
+ make a scatter plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.setp>setp</a>
+
+ </th>
+
+ <td align="left">
+ set a handle graphics property
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.semilogx>semilogx</a>
+
+ </th>
+
+ <td align="left">
+ log x axis
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.semilogy>semilogy</a>
+
+ </th>
+
+ <td align="left">
+ log y axis
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.show>show</a>
+
+ </th>
+
+ <td align="left">
+ show the figures
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.specgram>specgram</a>
+
+ </th>
+
+ <td align="left">
+ a spectrogram plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.spy>spy</a>
+
+ </th>
+
+ <td align="left">
+ plot sparsity pattern using markers or image
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.stem>stem</a>
+
+ </th>
+
+ <td align="left">
+ make a stem plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.subplot>subplot</a>
+
+ </th>
+
+ <td align="left">
+ make a subplot (numrows, numcols, axesnum)
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.subplots_adjust>subplots_adjust</a>
+
+ </th>
+
+ <td align="left">
+ change the params controlling the subplot positions of current figure
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.subplot_tool>subplot_tool</a>
+
+ </th>
+
+ <td align="left">
+ launch the subplot configuration tool
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.suptitle>suptitle</a>
+
+ </th>
+
+ <td align="left">
+ add a figure title
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.table>table</a>
+
+ </th>
+
+ <td align="left">
+ add a table to the plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.text>text</a>
+
+ </th>
+
+ <td align="left">
+ add some text at location x,y to the current axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.thetagrids>thetagrids</a>
+
+ </th>
+
+ <td align="left">
+ customize the radial theta grids and labels for polar
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.title>title</a>
+
+ </th>
+
+ <td align="left">
+ add a title to the current axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.xcorr>xcorr</a>
+
+ </th>
+
+ <td align="left">
+ plot the autocorrelation function of x and y
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.xlim>xlim</a>
+
+ </th>
+
+ <td align="left">
+ set/get the xlimits
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.ylim>ylim</a>
+
+ </th>
+
+ <td align="left">
+ set/get the ylimits
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.xticks>xticks</a>
+
+ </th>
+
+ <td align="left">
+ set/get the xticks
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.yticks>yticks</a>
+
+ </th>
+
+ <td align="left">
+ set/get the yticks
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.xlabel>xlabel</a>
+
+ </th>
+
+ <td align="left">
+ add an xlabel to the current axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.ylabel>ylabel</a>
+
+ </th>
+
+ <td align="left">
+ add a ylabel to the current axes
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.autumn>autumn</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to autumn
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.bone>bone</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to bone
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.cool>cool</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to cool
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.copper>copper</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to copper
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.flag>flag</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to flag
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.gray>gray</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to gray
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.hot>hot</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to hot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.hsv>hsv</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to hsv
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.jet>jet</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to jet
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.pink>pink</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to pink
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.prism>prism</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to prism
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.spring>spring</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to spring
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.summer>summer</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to summer
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.winter>winter</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to winter
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href=api/pyplot_api.html#matplotlib.pyplot.spectral>spectral</a>
+
+ </th>
+
+ <td align="left">
+ set the default colormap to spectral
+ </td>
+
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+</table>
+{% endblock %}
Added: trunk/matplotlib/doc/_templates/indexsidebar.html
===================================================================
--- trunk/matplotlib/doc/_templates/indexsidebar.html (rev 0)
+++ trunk/matplotlib/doc/_templates/indexsidebar.html 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,21 @@
+<h3>Download</h3>
+<p>Current version: <b>{{ version }}</b></p>
+<p>Get matplotlib from the sourceforge <a
+href="http://sourceforge.net/projects/matplotlib">download</a> page
+
+<h3>Need help?</h3>
+<p>Join the matplotlib <a
+href="http://sourceforge.net/mail/?group_id=80706">mailing lists</a>
+
+<p>You can file bugs and patches on the sourceforge <a href="http://sourceforge.net/tracker/?group_id=80706">tracker</a>, but it is a good idea to ping us on the mailing list too.</p>
+
+<h3>Screenshots</h3>
+
+<a href="{{ pathto('users/screenshots') }}"><img align=center src="{{
+pathto("_static/logo_sidebar.png", 1) }}"></a>
+
+<a href="{{ pathto('users/screenshots') }}">screenshots</a> and <a href=examples>examples</a>
+
+
+
+
Added: trunk/matplotlib/doc/_templates/layout.html
===================================================================
--- trunk/matplotlib/doc/_templates/layout.html (rev 0)
+++ trunk/matplotlib/doc/_templates/layout.html 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,19 @@
+{% extends "!layout.html" %}
+
+{% block rootrellink %}
+ <li><a href="{{ pathto('index') }}">matplotlib home </a> | </li>
+ <li><a href="{{ pathto('contents') }}">documentation </a> »</li>
+{% endblock %}
+
+{% block relbar1 %}
+<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
+<img src="{{ pathto("_static/logo2.png", 1) }}">
+</div>
+{{ super() }}
+{% endblock %}
+
+{# put the sidebar before the body #}
+{% block sidebar1 %}{{ sidebar() }}{% endblock %}
+{% block sidebar2 %}{% endblock %}
+
+
Modified: trunk/matplotlib/doc/api/index.rst
===================================================================
--- trunk/matplotlib/doc/api/index.rst 2008-10-14 15:59:49 UTC (rev 6186)
+++ trunk/matplotlib/doc/api/index.rst 2008-10-14 21:16:51 UTC (rev 6187)
@@ -22,5 +22,6 @@
collections_api.rst
colorbar_api.rst
colors_api.rst
+ path_api.rst
pyplot_api.rst
index_backend_api.rst
Added: trunk/matplotlib/doc/api/path_api.rst
===================================================================
--- trunk/matplotlib/doc/api/path_api.rst (rev 0)
+++ trunk/matplotlib/doc/api/path_api.rst 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,12 @@
+***************
+matplotlib path
+***************
+
+
+:mod:`matplotlib.path`
+=======================
+
+.. automodule:: matplotlib.path
+ :members:
+ :undoc-members:
+ :show-inheritance:
Modified: trunk/matplotlib/doc/conf.py
===================================================================
--- trunk/matplotlib/doc/conf.py 2008-10-14 15:59:49 UTC (rev 6186)
+++ trunk/matplotlib/doc/conf.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -37,7 +37,7 @@
source_suffix = '.rst'
# The master toctree document.
-master_doc = 'index'
+master_doc = 'contents'
# General substitutions.
project = 'Matplotlib'
@@ -47,9 +47,10 @@
# other places throughout the built documents.
#
# The short X.Y version.
-version = '0.98'
+import matplotlib
+version = matplotlib.__version__
# The full version, including alpha/beta/rc tags.
-release = '0.98'
+release = version
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
@@ -81,7 +82,8 @@
# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
-html_style = 'matplotlib.css'
+#html_style = 'matplotlib.css'
+html_style = 'mpl.css'
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
@@ -108,12 +110,20 @@
# typographically correct entities.
#html_use_smartypants = True
+# Content template for the index page.
+html_index = 'index.html'
+
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
+# Custom sidebar templates, maps page names to templates.
+html_sidebars = {'index': 'indexsidebar.html',
+ }
+
+
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+html_additional_pages = {'index': 'index.html'}
# If false, no module index is generated.
#html_use_modindex = True
Modified: trunk/matplotlib/doc/devel/transformations.rst
===================================================================
--- trunk/matplotlib/doc/devel/transformations.rst 2008-10-14 15:59:49 UTC (rev 6186)
+++ trunk/matplotlib/doc/devel/transformations.rst 2008-10-14 21:16:51 UTC (rev 6187)
@@ -18,9 +18,3 @@
interval_contains, interval_contains_open
:show-inheritance:
-:mod:`matplotlib.path`
-=============================
-
-.. automodule:: matplotlib.path
- :members: Path, get_path_collection_extents
- :show-inheritance:
Modified: trunk/matplotlib/doc/matplotlibrc
===================================================================
--- trunk/matplotlib/doc/matplotlibrc 2008-10-14 15:59:49 UTC (rev 6186)
+++ trunk/matplotlib/doc/matplotlibrc 2008-10-14 21:16:51 UTC (rev 6187)
@@ -240,9 +240,9 @@
# The figure subplot parameters. All dimensions are fraction of the
# figure width or height
-#figure.subplot.left : 0.125 # the left side of the subplots of the figure
+figure.subplot.left : 0.2 # the left side of the subplots of the figure
#figure.subplot.right : 0.9 # the right side of the subplots of the figure
-#figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure
+figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure
#figure.subplot.top : 0.9 # the top of the subplots of the figure
#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
@@ -264,7 +264,7 @@
# the default savefig params can be different for the GUI backends.
# Eg, you may want a higher resolution, or to make the figure
# background white
-#savefig.dpi : 100 # figure dots per inch
+savefig.dpi : 80 # figure dots per inch
#savefig.facecolor : white # figure facecolor when saving
#savefig.edgecolor : white # figure edgecolor when saving
Modified: trunk/matplotlib/doc/pyplots/matplotlibrc
===================================================================
--- trunk/matplotlib/doc/pyplots/matplotlibrc 2008-10-14 15:59:49 UTC (rev 6186)
+++ trunk/matplotlib/doc/pyplots/matplotlibrc 2008-10-14 21:16:51 UTC (rev 6187)
@@ -240,9 +240,9 @@
# The figure subplot parameters. All dimensions are fraction of the
# figure width or height
-#figure.subplot.left : 0.125 # the left side of the subplots of the figure
+#figure.subplot.left : 0.15 # the left side of the subplots of the figure
#figure.subplot.right : 0.9 # the right side of the subplots of the figure
-#figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure
+#figure.subplot.bottom : 0.15 # the bottom of the subplots of the figure
#figure.subplot.top : 0.9 # the top of the subplots of the figure
#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
Added: trunk/matplotlib/doc/pyplots/screenshots_barchart_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_barchart_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_barchart_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,24 @@
+# a bar plot with errorbars
+# a bar plot with errorbars
+from pylab import *
+
+N = 5
+menMeans = (20, 35, 30, 35, 27)
+menStd = ( 2, 3, 4, 1, 2)
+
+ind = arange(N) # the x locations for the groups
+width = 0.35 # the width of the bars
+p1 = bar(ind, menMeans, width, color='r', yerr=menStd)
+
+womenMeans = (25, 32, 34, 20, 25)
+womenStd = ( 3, 5, 2, 3, 3)
+p2 = bar(ind+width, womenMeans, width, color='y', yerr=womenStd)
+
+ylabel('Scores')
+title('Scores by group and gender')
+xticks(ind+width, ('G1', 'G2', 'G3', 'G4', 'G5') )
+xlim(-width,len(ind))
+yticks(arange(0,41,10))
+
+legend( (p1[0], p2[0]), ('Men', 'Women'), shadow=True)
+show()
Added: trunk/matplotlib/doc/pyplots/screenshots_date_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_date_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_date_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+"""
+Show how to make date plots in matplotlib using date tick locators and
+formatters. See major_minor_demo1.py for more information on
+controlling major and minor ticks
+
+All matplotlib date plotting is done by converting date instances into
+days since the 0001-01-01 UTC. The conversion, tick locating and
+formatting is done behind the scenes so this is most transparent to
+you. The dates module provides several converter functions date2num
+and num2date
+
+"""
+
+import datetime
+import matplotlib.pyplot as plt
+import matplotlib.dates as mdates
+import matplotlib.mlab as mlab
+
+years = mdates.YearLocator() # every year
+months = mdates.MonthLocator() # every month
+yearsFmt = mdates.DateFormatter('%Y')
+
+intc = mlab.csv2rec('mpl_examples/data/intc.csv')
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.plot(intc.date, intc.adj_close)
+
+# format the ticks
+ax.xaxis.set_major_locator(years)
+ax.xaxis.set_major_formatter(yearsFmt)
+ax.xaxis.set_minor_locator(months)
+ax.autoscale_view()
+
+# format the coords message box
+def price(x): return '$%1.2f'%x
+ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
+ax.format_ydata = price
+
+ax.grid(True)
+plt.show()
Added: trunk/matplotlib/doc/pyplots/screenshots_ellipse_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_ellipse_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_ellipse_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,149 @@
+
+# This example can be boiled down to a more simplistic example
+# to show the problem, but bu including the upper and lower
+# bound ellipses, it demonstrates how significant this error
+# is to our plots.
+
+import math
+from pylab import *
+from matplotlib.patches import Ellipse, Arc
+
+# given a point x, y
+x = 2692.440
+y = 6720.850
+
+# get is the radius of a circle through this point
+r = math.sqrt( x*x+y*y )
+
+# show some comparative circles
+delta = 6
+
+
+##################################################
+def custom_ellipse( ax, x, y, major, minor, theta, numpoints = 750, **kwargs ):
+ xs = []
+ ys = []
+ incr = 2.0*math.pi / numpoints
+ incrTheta = 0.0
+ while incrTheta <= (2.0*math.pi):
+ a = major * math.cos( incrTheta )
+ b = minor * math.sin( incrTheta )
+ l = math.sqrt( ( a**2 ) + ( b**2 ) )
+ phi = math.atan2( b, a )
+ incrTheta += incr
+
+ xs.append( x + ( l * math.cos( theta + phi ) ) )
+ ys.append( y + ( l * math.sin( theta + phi ) ) )
+ # end while
+
+ incrTheta = 2.0*math.pi
+ a = major * math.cos( incrTheta )
+ b = minor * math.sin( incrTheta )
+ l = sqrt( ( a**2 ) + ( b**2 ) )
+ phi = math.atan2( b, a )
+ xs.append( x + ( l * math.cos( theta + phi ) ) )
+ ys.append( y + ( l * math.sin( theta + phi ) ) )
+
+ ellipseLine = ax.plot( xs, ys, **kwargs )
+
+
+
+
+##################################################
+# make the axes
+ax1 = subplot( 311, aspect='equal' )
+ax1.set_aspect( 'equal', 'datalim' )
+
+# make the lower-bound ellipse
+diam = (r - delta) * 2.0
+lower_ellipse = Ellipse( (0.0, 0.0), diam, diam, 0.0, fill=False, edgecolor="darkgreen" )
+ax1.add_patch( lower_ellipse )
+
+# make the target ellipse
+diam = r * 2.0
+target_ellipse = Ellipse( (0.0, 0.0), diam, diam, 0.0, fill=False, edgecolor="darkred" )
+ax1.add_patch( target_ellipse )
+
+# make the upper-bound ellipse
+diam = (r + delta) * 2.0
+upper_ellipse = Ellipse( (0.0, 0.0), diam, diam, 0.0, fill=False, edgecolor="darkblue" )
+ax1.add_patch( upper_ellipse )
+
+# make the target
+diam = delta * 2.0
+target = Ellipse( (x, y), diam, diam, 0.0, fill=False, edgecolor="#DD1208" )
+ax1.add_patch( target )
+
+# give it a big marker
+ax1.plot( [x], [y], marker='x', linestyle='None', mfc='red', mec='red', markersize=10 )
+
+##################################################
+# make the axes
+ax = subplot( 312, aspect='equal' , sharex=ax1, sharey=ax1)
+ax.set_aspect( 'equal', 'datalim' )
+
+# make the lower-bound arc
+diam = (r - delta) * 2.0
+lower_arc = Arc( (0.0, 0.0), diam, diam, 0.0, fill=False, edgecolor="darkgreen" )
+ax.add_patch( lower_arc )
+
+# make the target arc
+diam = r * 2.0
+target_arc = Arc( (0.0, 0.0), diam, diam, 0.0, fill=False, edgecolor="darkred" )
+ax.add_patch( target_arc )
+
+# make the upper-bound arc
+diam = (r + delta) * 2.0
+upper_arc = Arc( (0.0, 0.0), diam, diam, 0.0, fill=False, edgecolor="darkblue" )
+ax.add_patch( upper_arc )
+
+# make the target
+diam = delta * 2.0
+target = Arc( (x, y), diam, diam, 0.0, fill=False, edgecolor="#DD1208" )
+ax.add_patch( target )
+
+# give it a big marker
+ax.plot( [x], [y], marker='x', linestyle='None', mfc='red', mec='red', markersize=10 )
+
+
+
+
+
+##################################################
+# now lets do the same thing again using a custom ellipse function
+
+
+
+# make the axes
+ax = subplot( 313, aspect='equal', sharex=ax1, sharey=ax1 )
+ax.set_aspect( 'equal', 'datalim' )
+
+# make the lower-bound ellipse
+custom_ellipse( ax, 0.0, 0.0, r-delta, r-delta, 0.0, color="darkgreen" )
+
+# make the target ellipse
+custom_ellipse( ax, 0.0, 0.0, r, r, 0.0, color="darkred" )
+
+# make the upper-bound ellipse
+custom_ellipse( ax, 0.0, 0.0, r+delta, r+delta, 0.0, color="darkblue" )
+
+# make the target
+custom_ellipse( ax, x, y, delta, delta, 0.0, color="#BB1208" )
+
+# give it a big marker
+ax.plot( [x], [y], marker='x', linestyle='None', mfc='red', mec='red', markersize=10 )
+
+
+# give it a big marker
+ax.plot( [x], [y], marker='x', linestyle='None', mfc='red', mec='red', markersize=10 )
+
+##################################################
+# lets zoom in to see the area of interest
+
+ax1.set_xlim(2650, 2735)
+ax1.set_ylim(6705, 6735)
+
+savefig("ellipse")
+show()
+
+
Added: trunk/matplotlib/doc/pyplots/screenshots_fill_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_fill_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_fill_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,7 @@
+from pylab import *
+t = arange(0.0, 1.01, 0.01)
+s = sin(2*2*pi*t)
+
+fill(t, s*exp(-5*t), 'r')
+grid(True)
+show()
Added: trunk/matplotlib/doc/pyplots/screenshots_histogram_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_histogram_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_histogram_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,20 @@
+from matplotlib import rcParams
+from pylab import *
+
+
+mu, sigma = 100, 15
+x = mu + sigma*randn(10000)
+
+# the histogram of the data
+n, bins, patches = hist(x, 100, normed=1)
+
+# add a 'best fit' line
+y = normpdf( bins, mu, sigma)
+l = plot(bins, y, 'r--', linewidth=2)
+xlim(40, 160)
+
+xlabel('Smarts')
+ylabel('P')
+title(r'$\rm{IQ:}\/ \mu=100,\/ \sigma=15$')
+
+show()
Added: trunk/matplotlib/doc/pyplots/screenshots_path_patch_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_path_patch_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_path_patch_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,36 @@
+import numpy as np
+import matplotlib.path as mpath
+import matplotlib.patches as mpatches
+import matplotlib.pyplot as plt
+
+Path = mpath.Path
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+
+pathdata = [
+ (Path.MOVETO, (1.58, -2.57)),
+ (Path.CURVE4, (0.35, -1.1)),
+ (Path.CURVE4, (-1.75, 2.0)),
+ (Path.CURVE4, (0.375, 2.0)),
+ (Path.LINETO, (0.85, 1.15)),
+ (Path.CURVE4, (2.2, 3.2)),
+ (Path.CURVE4, (3, 0.05)),
+ (Path.CURVE4, (2.0, -0.5)),
+ (Path.CLOSEPOLY, (1.58, -2.57)),
+ ]
+
+codes, verts = zip(*pathdata)
+path = mpath.Path(verts, codes)
+patch = mpatches.PathPatch(path, facecolor='red', edgecolor='yellow', alpha=0.5)
+ax.add_patch(patch)
+
+x, y = zip(*path.vertices)
+line, = ax.plot(x, y, 'go-')
+ax.grid()
+ax.set_xlim(-3,4)
+ax.set_ylim(-3,4)
+ax.set_title('spline paths')
+plt.show()
+
+
Added: trunk/matplotlib/doc/pyplots/screenshots_pie_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_pie_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_pie_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,26 @@
+"""
+Make a pie chart - see
+http://matplotlib.sf.net/matplotlib.pylab.html#-pie for the docstring.
+
+This example shows a basic pie chart with labels optional features,
+like autolabeling the percentage, offsetting a slice with "explode"
+and adding a shadow.
+
+Requires matplotlib0-0.70 or later
+
+"""
+from pylab import *
+
+# make a square figure and axes
+figure(1, figsize=(6,6))
+ax = axes([0.1, 0.1, 0.8, 0.8])
+
+labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+fracs = [15,30,45, 10]
+
+explode=(0, 0.05, 0, 0)
+pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
+title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5})
+
+show()
+
Added: trunk/matplotlib/doc/pyplots/screenshots_scatter_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_scatter_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_scatter_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,28 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.mlab as mlab
+
+intc = mlab.csv2rec('mpl_examples/data/intc.csv')
+
+delta1 = np.diff(intc.adj_close)/intc.adj_close[:-1]
+
+# size in points ^2
+volume = (15*intc.volume[:-2]/intc.volume[0])**2
+close = 0.003*intc.close[:-2]/0.003*intc.open[:-2]
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.75)
+
+#ticks = arange(-0.06, 0.061, 0.02)
+#xticks(ticks)
+#yticks(ticks)
+
+ax.set_xlabel(r'$\Delta_i$', fontsize=20)
+ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=20)
+ax.set_title('Volume and percent change')
+ax.grid(True)
+
+plt.show()
+
+
Added: trunk/matplotlib/doc/pyplots/screenshots_simple_plots.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_simple_plots.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_simple_plots.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,11 @@
+from pylab import *
+
+t = arange(0.0, 2.0, 0.01)
+s = sin(2*pi*t)
+plot(t, s, linewidth=1.0)
+
+xlabel('time (s)')
+ylabel('voltage (mV)')
+title('About as simple as it gets, folks')
+grid(True)
+show()
Added: trunk/matplotlib/doc/pyplots/screenshots_slider_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_slider_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_slider_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,43 @@
+from pylab import *
+from matplotlib.widgets import Slider, Button, RadioButtons
+
+ax = subplot(111)
+subplots_adjust(left=0.25, bottom=0.25)
+t = arange(0.0, 1.0, 0.001)
+a0 = 5
+f0 = 3
+s = a0*sin(2*pi*f0*t)
+l, = plot(t,s, lw=2, color='red')
+axis([0, 1, -10, 10])
+
+axcolor = 'lightgoldenrodyellow'
+axfreq = axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor)
+axamp = axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor)
+
+sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0)
+samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0)
+
+def update(val):
+ amp = samp.val
+ freq = sfreq.val
+ l.set_ydata(amp*sin(2*pi*freq*t))
+ draw()
+sfreq.on_changed(update)
+samp.on_changed(update)
+
+resetax = axes([0.8, 0.025, 0.1, 0.04])
+button = Button(resetax, 'Reset', color=axcolor, hovercolor=0.975)
+def reset(event):
+ sfreq.reset()
+ samp.reset()
+button.on_clicked(reset)
+
+rax = axes([0.025, 0.5, 0.15, 0.15], axisbg=axcolor)
+radio = RadioButtons(rax, ('red', 'blue', 'green'), active=0)
+def colorfunc(label):
+ l.set_color(label)
+ draw()
+radio.on_clicked(colorfunc)
+
+show()
+
Added: trunk/matplotlib/doc/pyplots/screenshots_subplot_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_subplot_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_subplot_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+from pylab import *
+
+def f(t):
+ s1 = cos(2*pi*t)
+ e1 = exp(-t)
+ return multiply(s1,e1)
+
+t1 = arange(0.0, 5.0, 0.1)
+t2 = arange(0.0, 5.0, 0.02)
+t3 = arange(0.0, 2.0, 0.01)
+
+subplot(211)
+plot(t1, f(t1), 'bo', t2, f(t2), 'k--', markerfacecolor='green')
+grid(True)
+title('A tale of 2 subplots')
+ylabel('Damped oscillation')
+
+subplot(212)
+plot(t3, cos(2*pi*t3), 'r.')
+grid(True)
+xlabel('time (s)')
+ylabel('Undamped')
+show()
+
Added: trunk/matplotlib/doc/pyplots/screenshots_table_demo.py
===================================================================
--- trunk/matplotlib/doc/pyplots/screenshots_table_demo.py (rev 0)
+++ trunk/matplotlib/doc/pyplots/screenshots_table_demo.py 2008-10-14 21:16:51 UTC (rev 6187)
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+import matplotlib
+
+from pylab import *
+from matplotlib.colors import colorConverter
+
+
+#Some simple functions to generate colours.
+def pastel(colour, weight=2.4):
+ """ Convert colour into a nice pastel shade"""
+ rgb = asarray(colorConverter.to_rgb(colour))
+ # scale colour
+ maxc = max(rgb)
+ if maxc < 1.0 and maxc > 0:
+ # scale colour
+ scale = 1.0 / maxc
+ rgb = rgb * scale
+ # now decrease saturation
+ total = sum(rgb)
+ slack = 0
+ for x in rgb:
+ slack += 1.0 - x
+
+ # want to increase weight from total to weight
+ # pick x s.t. slack * x == weight - total
+ # x = (weight - total) / slack
+ x = (weight - total) / slack
+
+ rgb = [c + (x * (1.0-c)) for c in rgb]
+
+ return rgb
+
+def get_colours(n):
+ """ Return n pastel colours. """
+ base = asarray([[1,0,0], [0,1,0], [0,0,1]])
+
+ if n <= 3:
+ return base[0:n]
+
+ # how many new colours to we need to insert between
+ # red and green and between green and blue?
+ needed = (((n - 3) + 1) / 2, (n - 3) / 2)
+
+ colours = []
+ for start in (0, 1):
+ for x in linspace(0, 1, needed[start]+2):
+ colours.append((base[start] * (1.0 - x)) +
+ (base[start+1] * x))
+
+ return [pastel(c) for c in colours[0:n]]
+
+
+
+axes([0.2, 0.2, 0.7, 0.6]) # leave room below the axes for the table
+
+data = [[ 66386, 174296, 75131, 577908, 32015],
+ [ 58230, 381139, 78045, 99308, 160454],
+ [ 89135, 80552, 152558, 497981, 603535],
+ [ 78415, 81858, 150656, 193263, 69638],
+ [ 139361, 331509, 343164, 781380, 52269]]
+
+colLabels = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
+rowLabels = ['%d year' % x for x in (100, 50, 20, 10, 5)]
+
+# Get some pastel shades for the colours
+colours = get_colours(len(colLabels))
+colours.reverse()
+rows = len(data)
+
+ind = arange(len(colLabels)) + 0.3 # the x locations for the groups
+cellText = []
+width = 0.4 # the width of the bars
+yoff = array([0.0] * len(colLabels)) # the bottom values for stacked bar chart
+for row in xrange(rows):
+ bar(ind, data[row], width, bottom=yoff, color=colours[row])
+ yoff = yoff + data[row]
+ cellText.append(['%1.1f' % (x/1000.0) for x in yoff])
+
+# Add a table at the bottom of the axes
+colours.reverse()
+cellText.reverse()
+the_table = table(cellText=cellText,
+ rowLabels=rowLabels, rowColours=colours,
+ colLabels=colLabels,
+ loc='bottom')
+ylabel("Loss $1000's")
+vals = arange(0, 2500, 500)
+yticks(vals*1000, ['%d' % val for val in vals])
+xticks([])
+title('Loss by Disaster')
+#savefig('table_demo_small', dpi=75)
+#savefig('table_demo_large', dpi=300)
+
+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-14 15:59:49 UTC (rev 6186)
+++ trunk/matplotlib/doc/pyplots/tex_demo.pdf 2008-10-14 21:16:51 UTC (rev 6187)
@@ -4,9 +4,9 @@
<< /Type /Catalog /Pages 3 0 R >>
endobj
2 0 obj
-<< /CreationDate (D:20080731010125-07'00')
+<< /CreationDate (D:20081014161405-05'00')
/Producer (matplotlib pdf backend)
-/Creator (matplotlib 0.98.3rc2, http://matplotlib.sf.net) >>
+/Creator (matplotlib 0.98.3, http://matplotlib.sf.net) >>
endobj
3 0 obj
<< /Count 1 /Kids [ 4 0 R ] /Type /Pages >>
@@ -44,214 +44,637 @@
1864
endobj
36 0 obj
-<< /BaseFont /CMSY10 /Type /Font /Subtype /Type1 /FontDescriptor 35 0 R
+<< /BaseFont /CMMI12 /Type /Font /Subtype /Type1 /FontDescriptor 35 0 R
/Widths 34 0 R /LastChar 125 /FirstChar 0 >>
endobj
34 0 obj
-[ 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 ]
+[ 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 ]
endobj
35 0 obj
-<< /FontFile 37 0 R /FontName /CMSY10 /Descent -960
-/FontBBox [ -29 -960 1116 775 ] /CapHeight 1000 /Ascent 775
+<< /FontFile 37 0 R /FontName /CMMI12 /Descent -250
+/FontBBox [ -30 -250 1026 750 ] /CapHeight 1000 /Ascent 750
/FontFamily (Computer Modern) /StemV 50 /Flags 68 /XHeight 500
/ItalicAngle -14 /Type /FontDescriptor >>
endobj
37 0 obj
-<< /Length3 0 /Length2 21763 /Length1 4313 /Length 23626
+<< /Length3 0 /Length2 27245 /Length1 3667 /Length 28908
/Filter /FlateDecode >>
stream
-x\x9C\x94\xBAuX\x95[\xD7=LKKKʦA\xBA\xBBC\xBAK\xBA6\xB0a\xD3\xDD]"\xD2\xDD(\x8DHw*ݍH\x97tI\xF7o{\xDE\xF3<x\xE2\xF9\xAE\xEB\xBB\xF8\x879\xE6Z\xF7=\xC6Zk\xCC5o\x85\x8ALY\x8DQ\xD4\xCC\xCE(eg\xEB\xCC\xC8\xCA\xC4\xCAWP{\xC3\xCA`ebA\xA3\xA2w;\x83\xECl%\x8C\x9D\x81| |
|
From: <jd...@us...> - 2008-10-14 15:59:55
|
Revision: 6186
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6186&view=rev
Author: jdh2358
Date: 2008-10-14 15:59:49 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
fixed data file in rec group by example
Modified Paths:
--------------
trunk/matplotlib/examples/misc/rec_groupby_demo.py
Modified: trunk/matplotlib/examples/misc/rec_groupby_demo.py
===================================================================
--- trunk/matplotlib/examples/misc/rec_groupby_demo.py 2008-10-14 15:57:59 UTC (rev 6185)
+++ trunk/matplotlib/examples/misc/rec_groupby_demo.py 2008-10-14 15:59:49 UTC (rev 6186)
@@ -2,7 +2,7 @@
import matplotlib.mlab as mlab
-r = mlab.csv2rec('../data/intc.csv')
+r = mlab.csv2rec('../data/aapl.csv')
r.sort()
def daily_return(prices):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-14 15:58:04
|
Revision: 6185
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6185&view=rev
Author: jdh2358
Date: 2008-10-14 15:57:59 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
fixed data file in rec group by example
Modified Paths:
--------------
trunk/matplotlib/examples/misc/rec_groupby_demo.py
Modified: trunk/matplotlib/examples/misc/rec_groupby_demo.py
===================================================================
--- trunk/matplotlib/examples/misc/rec_groupby_demo.py 2008-10-14 15:51:44 UTC (rev 6184)
+++ trunk/matplotlib/examples/misc/rec_groupby_demo.py 2008-10-14 15:57:59 UTC (rev 6185)
@@ -2,7 +2,7 @@
import matplotlib.mlab as mlab
-r = mlab.csv2rec('data/aapl.csv')
+r = mlab.csv2rec('../data/intc.csv')
r.sort()
def daily_return(prices):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-14 15:51:54
|
Revision: 6184
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6184&view=rev
Author: jdh2358
Date: 2008-10-14 15:51:44 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
added long/short rec array example
Added Paths:
-----------
trunk/matplotlib/examples/misc/longshort.py
Added: trunk/matplotlib/examples/misc/longshort.py
===================================================================
--- trunk/matplotlib/examples/misc/longshort.py (rev 0)
+++ trunk/matplotlib/examples/misc/longshort.py 2008-10-14 15:51:44 UTC (rev 6184)
@@ -0,0 +1,47 @@
+"""
+Illustrate the rec array utility funcitons by loading prices from a
+csv file, computing the daily returns, appending the results to the
+record arrays, joining on date
+"""
+import urllib
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.mlab as mlab
+
+# grab the price data off yahoo
+u1 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=AAPL&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')
+u2 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=GOOG&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')
+
+# load the CSV files into record arrays
+r1 = mlab.csv2rec(file(u1[0]))
+r2 = mlab.csv2rec(file(u2[0]))
+
+# compute the daily returns and add these columns to the arrays
+gains1 = np.zeros_like(r1.adj_close)
+gains2 = np.zeros_like(r2.adj_close)
+gains1[1:] = np.diff(r1.adj_close)/r1.adj_close[:-1]
+gains2[1:] = np.diff(r2.adj_close)/r2.adj_close[:-1]
+r1 = mlab.rec_append_fields(r1, 'gains', gains1)
+r2 = mlab.rec_append_fields(r2, 'gains', gains2)
+
+# now join them by date; the default postfixes are 1 and 2. The
+# default jointype is inner so it will do an intersection of dates and
+# drop the dates in AAPL which occurred before GOOG started trading in
+# 2004. r1 and r2 are reverse ordered by date since Yahoo returns
+# most recent first in the CSV files, but rec_join will sort by key so
+# r below will be properly sorted
+r = mlab.rec_join('date', r1, r2)
+
+
+# long appl, short goog
+g = r.gains1-r.gains2
+tr = (1+g).cumprod() # the total return
+
+# plot the return
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.plot(r.date, tr)
+ax.set_title('total return: long appl, short goog')
+ax.grid()
+fig.autofmt_xdate()
+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-14 13:19:49
|
Revision: 6183
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6183&view=rev
Author: jdh2358
Date: 2008-10-14 13:19:31 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
point to new sf web server
Modified Paths:
--------------
trunk/matplotlib/doc/make.py
Modified: trunk/matplotlib/doc/make.py
===================================================================
--- trunk/matplotlib/doc/make.py 2008-10-13 19:16:58 UTC (rev 6182)
+++ trunk/matplotlib/doc/make.py 2008-10-14 13:19:31 UTC (rev 6183)
@@ -16,11 +16,11 @@
def sf():
'push a copy to the sf site'
- os.system('cd build; rsync -avz html jd...@ma...:/home/groups/m/ma/matplotlib/htdocs/doc/ -essh')
+ os.system('cd build; rsync -avz html jd...@we...:/home/groups/m/ma/matplotlib/htdocs/doc/ -essh')
def sfpdf():
'push a copy to the sf site'
- os.system('cd build/latex; scp Matplotlib.pdf jd...@ma...:/home/groups/m/ma/matplotlib/htdocs/doc/')
+ os.system('cd build/latex; scp Matplotlib.pdf jd...@we...:/home/groups/m/ma/matplotlib/htdocs/doc/')
def figs():
os.system('cd users/figures/ && python make.py')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-13 19:17:09
|
Revision: 6182
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6182&view=rev
Author: jdh2358
Date: 2008-10-13 19:16:58 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
more fixes to mlab/excel formatters
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/lib/mpl_toolkits/exceltools.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-13 18:10:39 UTC (rev 6181)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-13 19:16:58 UTC (rev 6182)
@@ -2181,7 +2181,7 @@
def tostr(self, x):
if x is None: return 'None'
- return (self.fmt%self.toval(x)).rstrip('.')
+ return self.fmt%self.toval(x)
Modified: trunk/matplotlib/lib/mpl_toolkits/exceltools.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/exceltools.py 2008-10-13 18:10:39 UTC (rev 6181)
+++ trunk/matplotlib/lib/mpl_toolkits/exceltools.py 2008-10-13 19:16:58 UTC (rev 6182)
@@ -41,8 +41,11 @@
xlstyle.num_format_str = '0.%s%%;[RED]-0.%s%%'%(zeros, zeros)
format.scale = 1.
elif isinstance(format, mlab.FormatFloat):
- zeros = ''.join(['0']*format.precision)
- xlstyle.num_format_str = '#,##0.%s;[RED]-#,##0.%s'%(zeros, zeros)
+ if format.precision>0:
+ zeros = ''.join(['0']*format.precision)
+ xlstyle.num_format_str = '#,##0.%s;[RED]-#,##0.%s'%(zeros, zeros)
+ else:
+ xlstyle.num_format_str = '#,##;[RED]-#,##'
elif isinstance(format, mlab.FormatInt):
xlstyle.num_format_str = '#,##;[RED]-#,##'
else:
@@ -99,11 +102,11 @@
ind = np.arange(len(r.dtype.names))
for row in r:
- #print 'row',
+
for i in ind:
val = row[i]
format = formats[i]
-
+ val = format.toval(val)
if mlab.safe_isnan(val):
ws.write(rownum, colnum+i, nanstr)
elif mlab.safe_isinf(val):
@@ -112,11 +115,8 @@
else: s = '-%s'%infstr
ws.write(rownum, colnum+i, s)
elif format.xlstyle is None:
- val = format.toval(val)
ws.write(rownum, colnum+i, val)
else:
- val = format.toval(val)
- #print (i, r.dtype.names[i], val, format.toval(val)),
ws.write(rownum, colnum+i, val, format.xlstyle)
rownum += 1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-13 18:10:49
|
Revision: 6181
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6181&view=rev
Author: jdh2358
Date: 2008-10-13 18:10:39 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
updates to formatters
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/lib/mpl_toolkits/exceltools.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-11 18:27:35 UTC (rev 6180)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-13 18:10:39 UTC (rev 6181)
@@ -2173,15 +2173,19 @@
# def tostr(self, x):
# return '"%r"'%self.toval(x)
+
+
class FormatFormatStr(FormatObj):
def __init__(self, fmt):
self.fmt = fmt
def tostr(self, x):
if x is None: return 'None'
- return self.fmt%self.toval(x)
+ return (self.fmt%self.toval(x)).rstrip('.')
+
+
class FormatFloat(FormatFormatStr):
def __init__(self, precision=4, scale=1.):
FormatFormatStr.__init__(self, '%%1.%df'%precision)
@@ -2198,6 +2202,10 @@
class FormatInt(FormatObj):
+
+ def tostr(self, x):
+ return '%d'%int(x)
+
def toval(self, x):
return int(x)
Modified: trunk/matplotlib/lib/mpl_toolkits/exceltools.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/exceltools.py 2008-10-11 18:27:35 UTC (rev 6180)
+++ trunk/matplotlib/lib/mpl_toolkits/exceltools.py 2008-10-13 18:10:39 UTC (rev 6181)
@@ -99,10 +99,11 @@
ind = np.arange(len(r.dtype.names))
for row in r:
+ #print 'row',
for i in ind:
val = row[i]
format = formats[i]
- val = format.toval(val)
+
if mlab.safe_isnan(val):
ws.write(rownum, colnum+i, nanstr)
elif mlab.safe_isinf(val):
@@ -111,15 +112,14 @@
else: s = '-%s'%infstr
ws.write(rownum, colnum+i, s)
elif format.xlstyle is None:
+ val = format.toval(val)
ws.write(rownum, colnum+i, val)
else:
+ val = format.toval(val)
+ #print (i, r.dtype.names[i], val, format.toval(val)),
ws.write(rownum, colnum+i, val, format.xlstyle)
rownum += 1
if autosave:
wb.save(filename)
return rownum
-
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2008-10-11 18:27:43
|
Revision: 6180
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6180&view=rev
Author: jouni
Date: 2008-10-11 18:27:35 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
Mention the pdf flushing fix in CHANGELOG
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-10-11 13:48:18 UTC (rev 6179)
+++ trunk/matplotlib/CHANGELOG 2008-10-11 18:27:35 UTC (rev 6180)
@@ -1,3 +1,7 @@
+2008-10-11 Fixed bug in pdf backend: if you pass a file object for
+ output instead of a filename, e.g. in a wep app, we now
+ flush the object at the end. - JKS
+
2008-10-08 Add path simplification support to paths with gaps. - EF
2008-10-05 Fix problem with AFM files that don't specify the font's
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2008-10-11 13:48:30
|
Revision: 6179
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6179&view=rev
Author: jouni
Date: 2008-10-11 13:48:18 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
When outputting a pdf file on a file object, flush the file at the end
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-10-10 19:43:34 UTC (rev 6178)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-10-11 13:48:18 UTC (rev 6179)
@@ -446,7 +446,9 @@
self.writeMarkers()
self.writeXref()
self.writeTrailer()
- if not self.passed_in_file_object:
+ if self.passed_in_file_object:
+ self.fh.flush()
+ else:
self.fh.close()
def write(self, data):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-10-10 19:43:42
|
Revision: 6178
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6178&view=rev
Author: efiring
Date: 2008-10-10 19:43:34 +0000 (Fri, 10 Oct 2008)
Log Message:
-----------
Permit chunking in the backend_agg draw_path() method.
This is experimental, and disabled by default; it can be enabled
by setting the rcParams['agg.path.chunksize'] before a path is
drawn.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-10-10 16:53:27 UTC (rev 6177)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-10-10 19:43:34 UTC (rev 6178)
@@ -62,7 +62,7 @@
self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done',
'debug-annoying')
- self.draw_path = self._renderer.draw_path
+ #self.draw_path = self._renderer.draw_path # see below
self.draw_markers = self._renderer.draw_markers
self.draw_path_collection = self._renderer.draw_path_collection
self.draw_quad_mesh = self._renderer.draw_quad_mesh
@@ -76,6 +76,28 @@
if __debug__: verbose.report('RendererAgg.__init__ done',
'debug-annoying')
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ nmax = rcParams['agg.path.chunksize'] # here at least for testing
+ npts = path.vertices.shape[0]
+ if nmax > 100 and npts > nmax and path.should_simplify:
+ nch = npy.ceil(npts/float(nmax))
+ chsize = int(npy.ceil(npts/nch))
+ i0 = npy.arange(0, npts, chsize)
+ i1 = npy.zeros_like(i0)
+ i1[:-1] = i0[1:] - 1
+ i1[-1] = npts
+ for ii0, ii1 in zip(i0, i1):
+ v = path.vertices[ii0:ii1,:]
+ c = path.codes
+ if c is not None:
+ c = c[ii0:ii1]
+ c[0] = Path.MOVETO # move to end of last chunk
+ p = Path(v, c)
+ self._renderer.draw_path(gc, p, transform, rgbFace)
+ else:
+ self._renderer.draw_path(gc, path, transform, rgbFace)
+
+
def draw_mathtext(self, gc, x, y, s, prop, angle):
"""
Draw the math text using matplotlib.mathtext
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-10-10 16:53:27 UTC (rev 6177)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-10-10 19:43:34 UTC (rev 6178)
@@ -488,7 +488,10 @@
'svg.embed_char_paths' : [True, validate_bool], # True to save all characters as paths in the SVG
'plugins.directory' : ['.matplotlib_plugins', str], # where plugin directory is locate
- 'path.simplify' : [False, validate_bool]
+ 'path.simplify' : [False, validate_bool],
+ 'agg.path.chunksize' : [0, validate_int] # 0 to disable chunking;
+ # recommend about 20000 to
+ # enable. Experimental.
}
if __name__ == '__main__':
Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template 2008-10-10 16:53:27 UTC (rev 6177)
+++ trunk/matplotlib/matplotlibrc.template 2008-10-10 19:43:34 UTC (rev 6178)
@@ -270,6 +270,16 @@
### CONTOUR PLOTS
#contour.negative_linestyle : dashed # dashed | solid
+### Agg rendering
+### Warning: experimental, 2008/10/10
+#agg.path.chunksize : 0 # 0 to disable; values in the range
+ # 10000 to 100000 can improve speed slightly
+ # and prevent an Agg rendering failure
+ # when plotting very large data sets,
+ # especially if they are very gappy.
+ # It may cause minor artifacts, though.
+ # A value of 20000 is probably a good
+ # starting point.
### SAVING FIGURES
#path.simplify : False # When True, simplify paths in vector backends, such as PDF, PS and SVG
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-10-10 16:53:32
|
Revision: 6177
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6177&view=rev
Author: mdboom
Date: 2008-10-10 16:53:27 +0000 (Fri, 10 Oct 2008)
Log Message:
-----------
Oops in last commit.
Modified Paths:
--------------
trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2008-10-10 16:51:04 UTC (rev 6176)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-10-10 16:53:27 UTC (rev 6177)
@@ -497,7 +497,7 @@
inline bool flush_queue(unsigned *cmd, double *x, double *y)
{
- if (!queue_nonempty())
+ if (queue_nonempty())
{
#if DEBUG_SIMPLIFY
if (m_queue_read >= m_queue_size)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-10-10 16:51:19
|
Revision: 6176
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6176&view=rev
Author: mdboom
Date: 2008-10-10 16:51:04 +0000 (Fri, 10 Oct 2008)
Log Message:
-----------
Simplify and remove redundant code.
Modified Paths:
--------------
trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2008-10-09 11:37:01 UTC (rev 6175)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-10-10 16:51:04 UTC (rev 6176)
@@ -145,20 +145,20 @@
m_haveMin(false), m_lastMax(false), m_maxX(0.0), m_maxY(0.0),
m_minX(0.0), m_minY(0.0), m_lastWrittenX(0.0), m_lastWrittenY(0.0),
m_done(false)
-#if DEBUG_SIMPLIFY
- , m_pushed(0), m_skipped(0)
-#endif
+ #if DEBUG_SIMPLIFY
+ , m_pushed(0), m_skipped(0)
+ #endif
{
// empty
}
-#if DEBUG_SIMPLIFY
- ~SimplifyPath()
- {
- if (m_simplify)
- printf("%d %d\n", m_pushed, m_skipped);
- }
-#endif
+ #if DEBUG_SIMPLIFY
+ ~SimplifyPath()
+ {
+ if (m_simplify)
+ printf("%d %d\n", m_pushed, m_skipped);
+ }
+ #endif
void rewind(unsigned path_id)
{
@@ -198,30 +198,18 @@
// will be popped from the queue in subsequent calls. The following
// block will empty the queue before proceeding to the main loop below.
// -- Michael Droettboom
- if (m_queue_read < m_queue_write)
- {
- const item& front = m_queue[m_queue_read++];
- unsigned cmd = front.cmd;
- *x = front.x;
- *y = front.y;
-#if DEBUG_SIMPLIFY
- printf((cmd == agg::path_cmd_move_to) ? "|" : "-");
- printf(" 1 %f %f\n", *x, *y);
-#endif
+ if (flush_queue(&cmd, x, y)) {
return cmd;
}
- m_queue_read = 0;
- m_queue_write = 0;
-
// If the queue is now empty, and the path was fully consumed
// in the last call to the main loop, return agg::path_cmd_stop to
// signal that there are no more points to emit.
if (m_done)
{
-#if DEBUG_SIMPLIFY
- printf(".\n");
-#endif
+ #if DEBUG_SIMPLIFY
+ printf(".\n");
+ #endif
return agg::path_cmd_stop;
}
@@ -242,16 +230,16 @@
//if we are starting a new path segment, move to the first point
// + init
-#if DEBUG_SIMPLIFY
- printf("x, y, code: %f, %f, %d\n", *x, *y, cmd);
-#endif
+ #if DEBUG_SIMPLIFY
+ printf("x, y, code: %f, %f, %d\n", *x, *y, cmd);
+ #endif
if (m_moveto || cmd == agg::path_cmd_move_to)
{
// m_moveto check is not generally needed because
// m_source generates an initial moveto; but it
// is retained for safety in case circumstances
// arise where this is not true.
- if (m_origdNorm2 && !m_after_moveto)
+ if (m_origdNorm2 != 0.0 && !m_after_moveto)
{
// m_origdNorm2 is nonzero only if we have a vector;
// the m_after_moveto check ensures we push this
@@ -267,7 +255,7 @@
// line segment, hence a break in the line, just
// like clipping, so we treat it the same way.
m_clipped = true;
- if (m_queue_read < m_queue_write)
+ if (queue_nonempty())
{
// If we did a push, empty the queue now.
break;
@@ -279,9 +267,9 @@
// Don't render line segments less than one pixel long
if (fabs(*x - m_lastx) < 1.0 && fabs(*y - m_lasty) < 1.0)
{
-#if DEBUG_SIMPLIFY
- m_skipped++;
-#endif
+ #if DEBUG_SIMPLIFY
+ m_skipped++;
+ #endif
continue;
}
@@ -296,9 +284,9 @@
m_lastx = *x;
m_lasty = *y;
m_clipped = true;
-#if DEBUG_SIMPLIFY
- m_skipped++;
-#endif
+ #if DEBUG_SIMPLIFY
+ m_skipped++;
+ #endif
continue;
}
@@ -307,11 +295,11 @@
// this orig vector is the reference vector we will build
// up the line to
- if (m_origdNorm2 == 0)
+ if (m_origdNorm2 == 0.0)
{
if (m_clipped)
{
- m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty);
+ queue_push(agg::path_cmd_move_to, m_lastx, m_lasty);
m_clipped = false;
}
@@ -329,9 +317,9 @@
m_lasty = m_maxY = *y;
m_lastWrittenX = m_minX = m_lastx;
m_lastWrittenY = m_minY = m_lasty;
-#if DEBUG_SIMPLIFY
- m_skipped++;
-#endif
+ #if DEBUG_SIMPLIFY
+ m_skipped++;
+ #endif
continue;
}
@@ -395,9 +383,9 @@
m_lastx = *x;
m_lasty = *y;
-#if DEBUG_SIMPLIFY
- m_skipped++;
-#endif
+ #if DEBUG_SIMPLIFY
+ m_skipped++;
+ #endif
continue;
}
//if we get here, then this vector was not similar enough to the
@@ -422,33 +410,23 @@
{
if (m_haveMin)
{
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
+ queue_push(agg::path_cmd_line_to, m_minX, m_minY);
}
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY);
+ queue_push(agg::path_cmd_line_to, m_maxX, m_maxY);
}
m_done = true;
}
// Return the first item in the queue, if any, otherwise
// indicate that we're done.
- if (m_queue_read < m_queue_write)
- {
- const item& front = m_queue[m_queue_read++];
- unsigned cmd = front.cmd;
- *x = front.x;
- *y = front.y;
-#if DEBUG_SIMPLIFY
- printf((cmd == agg::path_cmd_move_to) ? "|" : "-");
- printf(" 3 %f %f\n", *x, *y);
-
-#endif
+ if (flush_queue(&cmd, x, y)) {
return cmd;
}
else
{
-#if DEBUG_SIMPLIFY
- printf(".\n");
-#endif
+ #if DEBUG_SIMPLIFY
+ printf(".\n");
+ #endif
return agg::path_cmd_stop;
}
}
@@ -459,6 +437,7 @@
bool m_simplify;
double m_width, m_height;
+ static const int m_queue_size = 6;
struct item
{
item() {}
@@ -474,7 +453,7 @@
};
int m_queue_read;
int m_queue_write;
- item m_queue[6];
+ item m_queue[m_queue_size];
bool m_moveto;
bool m_after_moveto;
@@ -497,23 +476,65 @@
double m_lastWrittenY;
bool m_done;
-#if DEBUG_SIMPLIFY
- unsigned m_pushed;
- unsigned m_skipped;
-#endif
+ #if DEBUG_SIMPLIFY
+ unsigned m_pushed;
+ unsigned m_skipped;
+ #endif
- void _push(double* x, double* y)
+ inline void queue_push(const unsigned cmd, const double& x, const double& y)
{
+ #if DEBUG_SIMPLIFY
+ if (m_queue_write >= m_queue_size)
+ throw "Simplification queue overflow";
+ #endif
+ m_queue[m_queue_write++].set(cmd, x, y);
+ }
+
+ inline bool queue_nonempty()
+ {
+ return m_queue_read < m_queue_write;
+ }
+
+ inline bool flush_queue(unsigned *cmd, double *x, double *y)
+ {
+ if (!queue_nonempty())
+ {
+ #if DEBUG_SIMPLIFY
+ if (m_queue_read >= m_queue_size)
+ throw "Simplification queue overflow";
+ #endif
+
+ const item& front = m_queue[m_queue_read++];
+ *cmd = front.cmd;
+ *x = front.x;
+ *y = front.y;
+
+ #if DEBUG_SIMPLIFY
+ printf((cmd == agg::path_cmd_move_to) ? "|" : "-");
+ printf(" 1 %f %f\n", *x, *y);
+ #endif
+
+ return true;
+ }
+
+ m_queue_read = 0;
+ m_queue_write = 0;
+
+ return false;
+ }
+
+ inline void _push(double* x, double* y)
+ {
if (m_haveMin)
{
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
+ queue_push(agg::path_cmd_line_to, m_minX, m_minY);
}
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY);
+ queue_push(agg::path_cmd_line_to, m_maxX, m_maxY);
//if we clipped some segments between this line and the next line
//we are starting, we also need to move to the last point.
if (m_clipped) {
- m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty);
+ queue_push(agg::path_cmd_move_to, m_lastx, m_lasty);
}
else if (!m_lastMax)
{
@@ -523,7 +544,7 @@
//the line just drawn.
//Would be move_to if not for the artifacts
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_lastx, m_lasty);
+ queue_push(agg::path_cmd_line_to, m_lastx, m_lasty);
}
//now reset all the variables to get ready for the next line
@@ -544,7 +565,6 @@
#if DEBUG_SIMPLIFY
m_pushed += m_queue_write - m_queue_read;
#endif
-
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-10-09 11:37:05
|
Revision: 6175
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6175&view=rev
Author: mdboom
Date: 2008-10-09 11:37:01 +0000 (Thu, 09 Oct 2008)
Log Message:
-----------
Better version of 'show' warning that only emits when show() is run directly from the python or ipython console.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/__init__.py
Modified: trunk/matplotlib/lib/matplotlib/backends/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/__init__.py 2008-10-09 01:19:54 UTC (rev 6174)
+++ trunk/matplotlib/lib/matplotlib/backends/__init__.py 2008-10-09 11:37:01 UTC (rev 6175)
@@ -1,5 +1,6 @@
import matplotlib
+import inspect
import warnings
# ipython relies on interactive_bk being defined here
@@ -30,11 +31,14 @@
# for "show" or "draw_if_interactive", so if they are not defined
# by the backend, just do nothing
def do_nothing_show(*args, **kwargs):
- warnings.warn("""
+ frame = inspect.currentframe()
+ fname = inspect.getframeinfo(frame.f_back)[0]
+ if fname in ('<stdin>', '<ipython console>'):
+ warnings.warn("""
Your currently selected backend, '%s' does not support show().
Please select a GUI backend in your matplotlibrc file ('%s')
or with matplotlib.use()""" %
- (backend, matplotlib.matplotlib_fname()))
+ (backend, matplotlib.matplotlib_fname()))
def do_nothing(*args, **kwargs): pass
backend_version = getattr(backend_mod,'backend_version', 'unknown')
show = getattr(backend_mod, 'show', do_nothing_show)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-10-09 01:20:07
|
Revision: 6174
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6174&view=rev
Author: efiring
Date: 2008-10-09 01:19:54 +0000 (Thu, 09 Oct 2008)
Log Message:
-----------
path simplification for paths with gaps
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab_examples/clippedline.py
trunk/matplotlib/lib/matplotlib/path.py
trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-10-08 19:53:57 UTC (rev 6173)
+++ trunk/matplotlib/CHANGELOG 2008-10-09 01:19:54 UTC (rev 6174)
@@ -1,3 +1,5 @@
+2008-10-08 Add path simplification support to paths with gaps. - EF
+
2008-10-05 Fix problem with AFM files that don't specify the font's
full name or family name. - JKS
Modified: trunk/matplotlib/examples/pylab_examples/clippedline.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/clippedline.py 2008-10-08 19:53:57 UTC (rev 6173)
+++ trunk/matplotlib/examples/pylab_examples/clippedline.py 2008-10-09 01:19:54 UTC (rev 6174)
@@ -19,7 +19,7 @@
def set_data(self, *args, **kwargs):
Line2D.set_data(self, *args, **kwargs)
- if self._invalid:
+ if self._invalid:
self.recache()
self.xorig = np.array(self._x)
self.yorig = np.array(self._y)
Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py 2008-10-08 19:53:57 UTC (rev 6173)
+++ trunk/matplotlib/lib/matplotlib/path.py 2008-10-09 01:19:54 UTC (rev 6174)
@@ -109,9 +109,8 @@
assert vertices.ndim == 2
assert vertices.shape[1] == 2
- self.should_simplify = (codes is None and
- np.all(np.isfinite(vertices)) and
- len(vertices) >= 128)
+ self.should_simplify = (len(vertices) >= 128 and
+ (codes is None or np.all(codes <= Path.LINETO)))
self.codes = codes
self.vertices = vertices
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2008-10-08 19:53:57 UTC (rev 6173)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-10-09 01:19:54 UTC (rev 6174)
@@ -137,7 +137,8 @@
double width = 0.0, double height = 0.0) :
m_source(&source), m_quantize(quantize), m_simplify(simplify),
m_width(width + 1.0), m_height(height + 1.0), m_queue_read(0), m_queue_write(0),
- m_moveto(true), m_lastx(0.0), m_lasty(0.0), m_clipped(false),
+ m_moveto(true), m_after_moveto(false),
+ m_lastx(0.0), m_lasty(0.0), m_clipped(false),
m_do_clipping(width > 0.0 && height > 0.0),
m_origdx(0.0), m_origdy(0.0),
m_origdNorm2(0.0), m_dnorm2Max(0.0), m_dnorm2Min(0.0),
@@ -205,6 +206,7 @@
*y = front.y;
#if DEBUG_SIMPLIFY
printf((cmd == agg::path_cmd_move_to) ? "|" : "-");
+ printf(" 1 %f %f\n", *x, *y);
#endif
return cmd;
}
@@ -239,18 +241,40 @@
//if we are starting a new path segment, move to the first point
// + init
- if (m_moveto)
+
+#if DEBUG_SIMPLIFY
+ printf("x, y, code: %f, %f, %d\n", *x, *y, cmd);
+#endif
+ if (m_moveto || cmd == agg::path_cmd_move_to)
{
+ // m_moveto check is not generally needed because
+ // m_source generates an initial moveto; but it
+ // is retained for safety in case circumstances
+ // arise where this is not true.
+ if (m_origdNorm2 && !m_after_moveto)
+ {
+ // m_origdNorm2 is nonzero only if we have a vector;
+ // the m_after_moveto check ensures we push this
+ // vector to the queue only once.
+ _push(x,y);
+ }
+ m_after_moveto = true;
m_lastx = *x;
m_lasty = *y;
m_moveto = false;
m_origdNorm2 = 0.0;
-#if DEBUG_SIMPLIFY
- m_pushed++;
- printf("|");
-#endif
- return agg::path_cmd_move_to;
+ // A moveto resulting from a nan yields a missing
+ // line segment, hence a break in the line, just
+ // like clipping, so we treat it the same way.
+ m_clipped = true;
+ if (m_queue_read < m_queue_write)
+ {
+ // If we did a push, empty the queue now.
+ break;
+ }
+ continue;
}
+ m_after_moveto = false;
// Don't render line segments less than one pixel long
if (fabs(*x - m_lastx) < 1.0 && fabs(*y - m_lasty) < 1.0)
@@ -295,7 +319,7 @@
m_origdy = *y - m_lasty;
m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy;
- //set all the variables to reflect this new orig vecor
+ //set all the variables to reflect this new orig vector
m_dnorm2Max = m_origdNorm2;
m_dnorm2Min = 0.0;
m_haveMin = false;
@@ -376,7 +400,6 @@
#endif
continue;
}
-
//if we get here, then this vector was not similar enough to the
//line we are building, so we need to draw that line and start the
//next one.
@@ -384,46 +407,9 @@
//if the line needs to extend in the opposite direction from the
//direction we are drawing in, move back to we start drawing from
//back there.
- if (m_haveMin)
- {
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
- }
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY);
- //if we clipped some segments between this line and the next line
- //we are starting, we also need to move to the last point.
- if (m_clipped) {
- m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty);
- }
- else if (!m_lastMax)
- {
- //if the last line was not the longest line, then move back to
- //the end point of the last line in the sequence. Only do this
- //if not clipped, since in that case lastx,lasty is not part of
- //the line just drawn.
+ _push(x, y);
- //Would be move_to if not for the artifacts
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_lastx, m_lasty);
- }
-
- //now reset all the variables to get ready for the next line
- m_origdx = *x - m_lastx;
- m_origdy = *y - m_lasty;
- m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy;
-
- m_dnorm2Max = m_origdNorm2;
- m_dnorm2Min = 0.0;
- m_haveMin = false;
- m_lastMax = true;
- m_lastx = m_maxX = *x;
- m_lasty = m_maxY = *y;
- m_lastWrittenX = m_minX = m_lastx;
- m_lastWrittenY = m_minY = m_lasty;
-
- m_clipped = false;
-#if DEBUG_SIMPLIFY
- m_pushed += m_queue_write - m_queue_read;
-#endif
break;
}
@@ -453,6 +439,8 @@
*y = front.y;
#if DEBUG_SIMPLIFY
printf((cmd == agg::path_cmd_move_to) ? "|" : "-");
+ printf(" 3 %f %f\n", *x, *y);
+
#endif
return cmd;
}
@@ -489,6 +477,7 @@
item m_queue[6];
bool m_moveto;
+ bool m_after_moveto;
double m_lastx, m_lasty;
bool m_clipped;
bool m_do_clipping;
@@ -512,6 +501,52 @@
unsigned m_pushed;
unsigned m_skipped;
#endif
+
+ void _push(double* x, double* y)
+ {
+ if (m_haveMin)
+ {
+ m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
+ }
+ m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY);
+
+ //if we clipped some segments between this line and the next line
+ //we are starting, we also need to move to the last point.
+ if (m_clipped) {
+ m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty);
+ }
+ else if (!m_lastMax)
+ {
+ //if the last line was not the longest line, then move back to
+ //the end point of the last line in the sequence. Only do this
+ //if not clipped, since in that case lastx,lasty is not part of
+ //the line just drawn.
+
+ //Would be move_to if not for the artifacts
+ m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_lastx, m_lasty);
+ }
+
+ //now reset all the variables to get ready for the next line
+ m_origdx = *x - m_lastx;
+ m_origdy = *y - m_lasty;
+ m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy;
+
+ m_dnorm2Max = m_origdNorm2;
+ m_dnorm2Min = 0.0;
+ m_haveMin = false;
+ m_lastMax = true;
+ m_lastx = m_maxX = *x;
+ m_lasty = m_maxY = *y;
+ m_lastWrittenX = m_minX = m_lastx;
+ m_lastWrittenY = m_minY = m_lasty;
+
+ m_clipped = false;
+#if DEBUG_SIMPLIFY
+ m_pushed += m_queue_write - m_queue_read;
+#endif
+
+ }
+
};
#endif // __AGG_PY_PATH_ITERATOR_H__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-10-08 19:54:07
|
Revision: 6173
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6173&view=rev
Author: jdh2358
Date: 2008-10-08 19:53:57 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
fixed deprecation warning in legend
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/legend.py
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py 2008-10-08 18:16:49 UTC (rev 6172)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2008-10-08 19:53:57 UTC (rev 6173)
@@ -124,7 +124,7 @@
value=rcParams["legend."+name]
setattr(self,name,value)
if pad:
- warnings.DeprecationWarning("Use 'borderpad' instead of 'pad'.")
+ warnings.warn("Use 'borderpad' instead of 'pad'.", DeprecationWarning)
# 2008/10/04
if self.numpoints <= 0:
raise ValueError("numpoints must be >= 0; it was %d"% numpoints)
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-08 18:16:49 UTC (rev 6172)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-08 19:53:57 UTC (rev 6173)
@@ -1799,8 +1799,9 @@
def rec_join(key, r1, r2, jointype='inner', defaults=None, r1postfix='1', r2postfix='2'):
"""
- join record arrays r1 and r2 on key; key is a tuple of field
- names. If r1 and r2 have equal values on all the keys in the key
+ join record arrays r1 and r2 on key; key is a tuple of field names
+ -- if key is a string it is assumed to be a single attribute
+ name. If r1 and r2 have equal values on all the keys in the key
tuple, then their fields will be merged into a new record array
containing the intersection of the fields of r1 and r2.
@@ -1812,10 +1813,13 @@
The defaults keyword is a dictionary filled with
{column_name:default_value} pairs.
- The keywords r1postfix and r2postfix are postfixed to column names
+ The keywords r1postfix and r2postfix are postfixed to column names
(other than keys) that are both in r1 and r2.
"""
+ if cbook.is_string_like(key):
+ key = (key, )
+
for name in key:
if name not in r1.dtype.names:
raise ValueError('r1 does not have key field %s'%name)
@@ -1862,7 +1866,7 @@
keydesc = [key_desc(name) for name in key]
-
+
def mapped_r1field(name):
""" the column name in newrec that corresponds to the colmn in r1 """
if name in key or name not in r2.dtype.names: return name
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-10-08 18:16:51
|
Revision: 6172
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6172&view=rev
Author: mdboom
Date: 2008-10-08 18:16:49 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
More informative error message when data is too large for Agg to draw it.
Modified Paths:
--------------
trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h
Modified: trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h
===================================================================
--- trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h 2008-10-08 16:37:15 UTC (rev 6171)
+++ trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h 2008-10-08 18:16:49 UTC (rev 6172)
@@ -185,7 +185,10 @@
if((m_num_cells & cell_block_mask) == 0)
{
if(m_num_blocks >= cell_block_limit) {
- throw "Agg rendering complexity exceeded.";
+ /* If this exception is thrown too often, one can
+ increase cell_block_limit */
+ throw "Agg rendering complexity exceeded. "
+ "Consider downsampling or decimating your data.";
}
allocate_block();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-10-08 16:37:20
|
Revision: 6171
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6171&view=rev
Author: mdboom
Date: 2008-10-08 16:37:15 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
Throw exception when there are too many data points.
Modified Paths:
--------------
trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h
===================================================================
--- trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h 2008-10-08 14:38:26 UTC (rev 6170)
+++ trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h 2008-10-08 16:37:15 UTC (rev 6171)
@@ -29,6 +29,7 @@
#ifndef AGG_RASTERIZER_CELLS_AA_INCLUDED
#define AGG_RASTERIZER_CELLS_AA_INCLUDED
+#include <exception>
#include <string.h>
#include <math.h>
#include "agg_math.h"
@@ -183,7 +184,9 @@
{
if((m_num_cells & cell_block_mask) == 0)
{
- if(m_num_blocks >= cell_block_limit) return;
+ if(m_num_blocks >= cell_block_limit) {
+ throw "Agg rendering complexity exceeded.";
+ }
allocate_block();
}
*m_curr_cell_ptr++ = m_curr_cell;
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-10-08 14:38:26 UTC (rev 6170)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-10-08 16:37:15 UTC (rev 6171)
@@ -941,7 +941,11 @@
if (snap)
gc.isaa = false;
- _draw_path(curve, has_clippath, face, gc);
+ try {
+ _draw_path(curve, has_clippath, face, gc);
+ } catch (const char* e) {
+ throw Py::RuntimeError(e);
+ }
return Py::Object();
}
@@ -1175,20 +1179,24 @@
PathListGenerator path_generator(paths);
- _draw_path_collection_generic<PathListGenerator, 1, 1>
- (master_transform,
- cliprect,
- clippath,
- clippath_trans,
- path_generator,
- transforms_obj,
- offsets_obj,
- offset_trans,
- facecolors_obj,
- edgecolors_obj,
- linewidths,
- linestyles_obj,
- antialiaseds);
+ try {
+ _draw_path_collection_generic<PathListGenerator, 1, 1>
+ (master_transform,
+ cliprect,
+ clippath,
+ clippath_trans,
+ path_generator,
+ transforms_obj,
+ offsets_obj,
+ offset_trans,
+ facecolors_obj,
+ edgecolors_obj,
+ linewidths,
+ linestyles_obj,
+ antialiaseds);
+ } catch (const char *e) {
+ throw Py::RuntimeError(e);
+ }
return Py::Object();
}
@@ -1310,20 +1318,24 @@
}
try {
- _draw_path_collection_generic<QuadMeshGenerator, 0, 0>
- (master_transform,
- cliprect,
- clippath,
- clippath_trans,
- path_generator,
- transforms_obj,
- offsets_obj,
- offset_trans,
- facecolors_obj,
- edgecolors_obj,
- linewidths,
- linestyles_obj,
- antialiaseds);
+ try {
+ _draw_path_collection_generic<QuadMeshGenerator, 0, 0>
+ (master_transform,
+ cliprect,
+ clippath,
+ clippath_trans,
+ path_generator,
+ transforms_obj,
+ offsets_obj,
+ offset_trans,
+ facecolors_obj,
+ edgecolors_obj,
+ linewidths,
+ linestyles_obj,
+ antialiaseds);
+ } catch (const char* e) {
+ throw Py::RuntimeError(e);
+ }
} catch (...) {
if (free_edgecolors) Py_XDECREF(edgecolors_obj.ptr());
throw;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sa...@us...> - 2008-10-08 14:38:34
|
Revision: 6170
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6170&view=rev
Author: sameerd
Date: 2008-10-08 14:38:26 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
rec_join now handles two record arrays with the same column names with "*fixes"
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-08 14:09:55 UTC (rev 6169)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-08 14:38:26 UTC (rev 6170)
@@ -1665,6 +1665,14 @@
except TypeError: return False
else: return b
+def rec_view(rec):
+ """ Return a view of an ndarray as a recarray
+ http://projects.scipy.org/pipermail/numpy-discussion/2008-August/036429.html
+ Reverting Travis' fix because it doesn't work for object arrays
+ """
+ return rec.view(np.recarray)
+ #return rec.view(dtype=(np.record, rec.dtype), type=np.recarray)
+
def rec_append_field(rec, name, arr, dtype=None):
"""
return a new record array with field name populated with data from array arr.
@@ -1703,7 +1711,7 @@
newrec[field] = rec[field]
for name, arr in zip(names, arrs):
newrec[name] = arr
- return newrec.view(np.recarray)
+ return rec_view(newrec)
def rec_drop_fields(rec, names):
@@ -1719,7 +1727,7 @@
for field in newdtype.names:
newrec[field] = rec[field]
- return newrec.view(np.recarray)
+ return rec_view(newrec)
@@ -1789,7 +1797,7 @@
return np.rec.fromarrays(arrays, names=names)
-def rec_join(key, r1, r2, jointype='inner', defaults=None):
+def rec_join(key, r1, r2, jointype='inner', defaults=None, r1postfix='1', r2postfix='2'):
"""
join record arrays r1 and r2 on key; key is a tuple of field
names. If r1 and r2 have equal values on all the keys in the key
@@ -1803,6 +1811,9 @@
The defaults keyword is a dictionary filled with
{column_name:default_value} pairs.
+
+ The keywords r1postfix and r2postfix are postfixed to column names
+ (other than keys) that are both in r1 and r2.
"""
for name in key:
@@ -1850,13 +1861,21 @@
return (name, dt2.descr[0][1])
-
keydesc = [key_desc(name) for name in key]
+
+ def mapped_r1field(name):
+ """ the column name in newrec that corresponds to the colmn in r1 """
+ if name in key or name not in r2.dtype.names: return name
+ else: return name + r1postfix
- newdtype = np.dtype(keydesc +
- [desc for desc in r1.dtype.descr if desc[0] not in key ] +
- [desc for desc in r2.dtype.descr if desc[0] not in key ] )
+ def mapped_r2field(name):
+ """ the column name in newrec that corresponds to the colmn in r2 """
+ if name in key or name not in r1.dtype.names: return name
+ else: return name + r2postfix
+ r1desc = [(mapped_r1field(desc[0]), desc[1]) for desc in r1.dtype.descr if desc[0] not in key]
+ r2desc = [(mapped_r2field(desc[0]), desc[1]) for desc in r2.dtype.descr if desc[0] not in key]
+ newdtype = np.dtype(keydesc + r1desc + r2desc)
newrec = np.empty(common_len + left_len + right_len, dtype=newdtype)
@@ -1867,20 +1886,22 @@
newrec[k] = v
for field in r1.dtype.names:
+ newfield = mapped_r1field(field)
if common_len:
- newrec[field][:common_len] = r1[field][r1ind]
+ newrec[newfield][:common_len] = r1[field][r1ind]
if (jointype == "outer" or jointype == "leftouter") and left_len:
- newrec[field][common_len:(common_len+left_len)] = r1[field][left_ind]
+ newrec[newfield][common_len:(common_len+left_len)] = r1[field][left_ind]
for field in r2.dtype.names:
+ newfield = mapped_r2field(field)
if field not in key and common_len:
- newrec[field][:common_len] = r2[field][r2ind]
+ newrec[newfield][:common_len] = r2[field][r2ind]
if jointype == "outer" and right_len:
- newrec[field][-right_len:] = r2[field][right_ind]
+ newrec[newfield][-right_len:] = r2[field][right_ind]
newrec.sort(order=key)
- return newrec.view(np.recarray)
+ return rec_view(newrec)
def csv2rec(fname, comments='#', skiprows=0, checkrows=0, delimiter=',',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-10-08 14:10:07
|
Revision: 6169
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6169&view=rev
Author: mdboom
Date: 2008-10-08 14:09:55 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
Increase rendering cell limit in Agg.
Modified Paths:
--------------
trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h
Modified: trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h
===================================================================
--- trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h 2008-10-08 13:59:28 UTC (rev 6168)
+++ trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h 2008-10-08 14:09:55 UTC (rev 6169)
@@ -2,15 +2,15 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
-// Permission to copy, use, modify, sell and distribute this software
-// is granted provided this copyright notice appears in all copies.
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
//
-// The author gratefully acknowleges the support of David Turner,
-// Robert Wilhelm, and Werner Lemberg - the authors of the FreeType
+// The author gratefully acknowleges the support of David Turner,
+// Robert Wilhelm, and Werner Lemberg - the authors of the FreeType
// libray - in producing this work. See http://www.freetype.org for details.
//
//----------------------------------------------------------------------------
@@ -19,12 +19,12 @@
// http://www.antigrain.com
//----------------------------------------------------------------------------
//
-// Adaptation for 32-bit screen coordinates has been sponsored by
+// Adaptation for 32-bit screen coordinates has been sponsored by
// Liberty Technology Systems, Inc., visit http://lib-sys.com
//
// Liberty Technology Systems, Inc. is the provider of
// PostScript and PDF technology for software developers.
-//
+//
//----------------------------------------------------------------------------
#ifndef AGG_RASTERIZER_CELLS_AA_INCLUDED
#define AGG_RASTERIZER_CELLS_AA_INCLUDED
@@ -49,7 +49,7 @@
cell_block_size = 1 << cell_block_shift,
cell_block_mask = cell_block_size - 1,
cell_block_pool = 256,
- cell_block_limit = 1024
+ cell_block_limit = 4096
};
struct sorted_y
@@ -76,19 +76,19 @@
void sort_cells();
- unsigned total_cells() const
+ unsigned total_cells() const
{
return m_num_cells;
}
- unsigned scanline_num_cells(unsigned y) const
- {
- return m_sorted_y[y - m_min_y].num;
+ unsigned scanline_num_cells(unsigned y) const
+ {
+ return m_sorted_y[y - m_min_y].num;
}
const cell_type* const* scanline_cells(unsigned y) const
- {
- return m_sorted_cells.data() + m_sorted_y[y - m_min_y].start;
+ {
+ return m_sorted_cells.data() + m_sorted_y[y - m_min_y].start;
}
bool sorted() const { return m_sorted; }
@@ -101,7 +101,7 @@
void add_curr_cell();
void render_hline(int ey, int x1, int y1, int x2, int y2);
void allocate_block();
-
+
private:
unsigned m_num_blocks;
unsigned m_max_blocks;
@@ -124,7 +124,7 @@
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
rasterizer_cells_aa<Cell>::~rasterizer_cells_aa()
{
if(m_num_blocks)
@@ -140,7 +140,7 @@
}
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
rasterizer_cells_aa<Cell>::rasterizer_cells_aa() :
m_num_blocks(0),
m_max_blocks(0),
@@ -161,10 +161,10 @@
}
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
void rasterizer_cells_aa<Cell>::reset()
{
- m_num_cells = 0;
+ m_num_cells = 0;
m_curr_block = 0;
m_curr_cell.initial();
m_style_cell.initial();
@@ -176,7 +176,7 @@
}
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
AGG_INLINE void rasterizer_cells_aa<Cell>::add_curr_cell()
{
if(m_curr_cell.area | m_curr_cell.cover)
@@ -192,7 +192,7 @@
}
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
AGG_INLINE void rasterizer_cells_aa<Cell>::set_curr_cell(int x, int y)
{
if(m_curr_cell.not_equal(x, y, m_style_cell))
@@ -207,9 +207,9 @@
}
//------------------------------------------------------------------------
- template<class Cell>
- AGG_INLINE void rasterizer_cells_aa<Cell>::render_hline(int ey,
- int x1, int y1,
+ template<class Cell>
+ AGG_INLINE void rasterizer_cells_aa<Cell>::render_hline(int ey,
+ int x1, int y1,
int x2, int y2)
{
int ex1 = x1 >> poly_subpixel_shift;
@@ -305,14 +305,14 @@
}
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
AGG_INLINE void rasterizer_cells_aa<Cell>::style(const cell_type& style_cell)
- {
- m_style_cell.style(style_cell);
+ {
+ m_style_cell.style(style_cell);
}
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
void rasterizer_cells_aa<Cell>::line(int x1, int y1, int x2, int y2)
{
enum dx_limit_e { dx_limit = 16384 << poly_subpixel_shift };
@@ -358,7 +358,7 @@
//Vertical line - we have to calculate start and end cells,
//and then - the common values of the area and coverage for
- //all cells of the line. We know exactly there's only one
+ //all cells of the line. We know exactly there's only one
//cell, so, we don't have to call render_hline().
incr = 1;
if(dx == 0)
@@ -463,15 +463,15 @@
}
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
void rasterizer_cells_aa<Cell>::allocate_block()
{
if(m_curr_block >= m_num_blocks)
{
if(m_num_blocks >= m_max_blocks)
{
- cell_type** new_cells =
- pod_allocator<cell_type*>::allocate(m_max_blocks +
+ cell_type** new_cells =
+ pod_allocator<cell_type*>::allocate(m_max_blocks +
cell_block_pool);
if(m_cells)
@@ -483,7 +483,7 @@
m_max_blocks += cell_block_pool;
}
- m_cells[m_num_blocks++] =
+ m_cells[m_num_blocks++] =
pod_allocator<cell_type>::allocate(cell_block_size);
}
@@ -513,7 +513,7 @@
void qsort_cells(Cell** start, unsigned num)
{
Cell** stack[80];
- Cell*** top;
+ Cell*** top;
Cell** limit;
Cell** base;
@@ -538,7 +538,7 @@
i = base + 1;
j = limit - 1;
- // now ensure that *i <= *base <= *j
+ // now ensure that *i <= *base <= *j
if((*j)->x < (*i)->x)
{
swap_cells(i, j);
@@ -619,7 +619,7 @@
//------------------------------------------------------------------------
- template<class Cell>
+ template<class Cell>
void rasterizer_cells_aa<Cell>::sort_cells()
{
if(m_sorted) return; //Perform sort only the first time.
@@ -636,9 +636,9 @@
//for(unsigned nc = 0; nc < m_num_cells; nc++)
//{
// cell_type* cell = m_cells[nc >> cell_block_shift] + (nc & cell_block_mask);
-// if(cell->x < m_min_x ||
-// cell->y < m_min_y ||
-// cell->x > m_max_x ||
+// if(cell->x < m_min_x ||
+// cell->y < m_min_y ||
+// cell->x > m_max_x ||
// cell->y > m_max_y)
// {
// cell = cell; // Breakpoint here
@@ -660,19 +660,21 @@
{
cell_ptr = *block_ptr++;
i = cell_block_size;
- while(i--)
+ while(i--)
{
m_sorted_y[cell_ptr->y - m_min_y].start++;
++cell_ptr;
}
}
- cell_ptr = *block_ptr++;
i = m_num_cells & cell_block_mask;
- while(i--)
- {
- m_sorted_y[cell_ptr->y - m_min_y].start++;
- ++cell_ptr;
+ if (i) {
+ cell_ptr = *block_ptr++;
+ while(i--)
+ {
+ m_sorted_y[cell_ptr->y - m_min_y].start++;
+ ++cell_ptr;
+ }
}
// Convert the Y-histogram into the array of starting indexes
@@ -691,7 +693,7 @@
{
cell_ptr = *block_ptr++;
i = cell_block_size;
- while(i--)
+ while(i--)
{
sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y];
m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr;
@@ -699,15 +701,17 @@
++cell_ptr;
}
}
-
- cell_ptr = *block_ptr++;
+
i = m_num_cells & cell_block_mask;
- while(i--)
- {
- sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y];
- m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr;
- ++curr_y.num;
- ++cell_ptr;
+ if (i) {
+ cell_ptr = *block_ptr++;
+ while(i--)
+ {
+ sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y];
+ m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr;
+ ++curr_y.num;
+ ++cell_ptr;
+ }
}
// Finally arrange the X-arrays
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-10-08 13:59:39
|
Revision: 6168
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6168&view=rev
Author: mdboom
Date: 2008-10-08 13:59:28 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
Addresses this Ubuntu bug:
https://bugs.launchpad.net/ubuntu/+source/matplotlib/+bug/278764
Display a warning when show() is called with a non-GUI backend, so that the user is not left scratching their head when running "ipython -pylab"
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/__init__.py
Modified: trunk/matplotlib/lib/matplotlib/backends/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/__init__.py 2008-10-08 04:07:21 UTC (rev 6167)
+++ trunk/matplotlib/lib/matplotlib/backends/__init__.py 2008-10-08 13:59:28 UTC (rev 6168)
@@ -1,5 +1,6 @@
import matplotlib
+import warnings
# ipython relies on interactive_bk being defined here
from matplotlib.rcsetup import interactive_bk
@@ -28,9 +29,15 @@
# image backends like pdf, agg or svg do not need to do anything
# for "show" or "draw_if_interactive", so if they are not defined
# by the backend, just do nothing
+ def do_nothing_show(*args, **kwargs):
+ warnings.warn("""
+Your currently selected backend, '%s' does not support show().
+Please select a GUI backend in your matplotlibrc file ('%s')
+or with matplotlib.use()""" %
+ (backend, matplotlib.matplotlib_fname()))
def do_nothing(*args, **kwargs): pass
backend_version = getattr(backend_mod,'backend_version', 'unknown')
- show = getattr(backend_mod, 'show', do_nothing)
+ show = getattr(backend_mod, 'show', do_nothing_show)
draw_if_interactive = getattr(backend_mod, 'draw_if_interactive', do_nothing)
# Additional imports which only happen for certain backends. This section
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fer...@us...> - 2008-10-08 04:07:40
|
Revision: 6167
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6167&view=rev
Author: fer_perez
Date: 2008-10-08 04:07:21 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
Major rework of the sphinx template.
I'm committing this as a separate directory because I changed way too
much of the original code and I want to make sure others can have a
look before removing the old code.
Added Paths:
-----------
trunk/py4science/examples/sphinx_template2/
trunk/py4science/examples/sphinx_template2/Makefile
trunk/py4science/examples/sphinx_template2/README.txt
trunk/py4science/examples/sphinx_template2/conf.py
trunk/py4science/examples/sphinx_template2/index.rst
trunk/py4science/examples/sphinx_template2/model/
trunk/py4science/examples/sphinx_template2/model/api_docs.rst
trunk/py4science/examples/sphinx_template2/model/index.rst
trunk/py4science/examples/sphinx_template2/model/introduction.rst
trunk/py4science/examples/sphinx_template2/model/next_steps.rst
trunk/py4science/examples/sphinx_template2/model/sphinx_helpers.rst
trunk/py4science/examples/sphinx_template2/pyplots/
trunk/py4science/examples/sphinx_template2/pyplots/elegant.py
trunk/py4science/examples/sphinx_template2/pyplots/hairy.py
trunk/py4science/examples/sphinx_template2/simulations/
trunk/py4science/examples/sphinx_template2/simulations/finale.rst
trunk/py4science/examples/sphinx_template2/simulations/index.rst
trunk/py4science/examples/sphinx_template2/simulations/introduction.rst
trunk/py4science/examples/sphinx_template2/simulations/preliminary.rst
trunk/py4science/examples/sphinx_template2/tools/
trunk/py4science/examples/sphinx_template2/tools/sphinxext/
trunk/py4science/examples/sphinx_template2/tools/sphinxext/inheritance_diagram.py
trunk/py4science/examples/sphinx_template2/tools/sphinxext/ipython_console_highlighting.py
trunk/py4science/examples/sphinx_template2/tools/sphinxext/mathmpl.py
trunk/py4science/examples/sphinx_template2/tools/sphinxext/only_directives.py
trunk/py4science/examples/sphinx_template2/tools/sphinxext/plot_directive.py
trunk/py4science/examples/sphinx_template2/tools/static/
trunk/py4science/examples/sphinx_template2/tools/templates/
Added: trunk/py4science/examples/sphinx_template2/Makefile
===================================================================
--- trunk/py4science/examples/sphinx_template2/Makefile (rev 0)
+++ trunk/py4science/examples/sphinx_template2/Makefile 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,89 @@
+# Makefile for Sphinx documentation
+#
+
+PDFNAME=sampledoc
+SRCDIR=.
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER = letter
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
+
+.PHONY: help clean html web pickle htmlhelp latex changes linkcheck pdf all dist
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " pickle to make pickle files (usable by e.g. sphinx-web)"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " changes to make an overview over all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo
+ @echo "Compound utility targets:"
+ @echo " pdf latex and then runs the PDF generation"
+ @echo " all html and pdf"
+ @echo " dist all, and then puts the results in dist/"
+
+clean:
+ -rm -rf build/ dist/ _static/ pyplots/*png pyplots/*pdf
+
+pdf: latex
+ cd build/latex && make all-pdf
+
+all: html pdf
+
+dist: clean all
+ mkdir -p dist
+ ln build/latex/$(PDFNAME).pdf dist/
+ cp -al build/html dist/
+ @echo "Build finished. Final docs are in dist/"
+
+html:
+ mkdir -p build/html build/doctrees
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
+ @echo
+ @echo "Build finished. The HTML pages are in build/html."
+
+pickle:
+ mkdir -p build/pickle build/doctrees
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files or run"
+ @echo " sphinx-web build/pickle"
+ @echo "to start the sphinx-web server."
+
+web: pickle
+
+htmlhelp:
+ mkdir -p build/htmlhelp build/doctrees
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in build/htmlhelp."
+
+latex:
+ mkdir -p build/latex build/doctrees
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in build/latex."
+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+ "run these through (pdf)latex."
+
+changes:
+ mkdir -p build/changes build/doctrees
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
+ @echo
+ @echo "The overview file is in build/changes."
+
+linkcheck:
+ mkdir -p build/linkcheck build/doctrees
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in build/linkcheck/output.txt."
Added: trunk/py4science/examples/sphinx_template2/README.txt
===================================================================
--- trunk/py4science/examples/sphinx_template2/README.txt (rev 0)
+++ trunk/py4science/examples/sphinx_template2/README.txt 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,54 @@
+===========================
+ sphinx template sampledoc
+===========================
+
+This is the top level build directory for the sphinx "sampledoc" documentation.
+You can use this as a starter template for your own projects. The name
+"sampledoc" is the mock name for the project, you'll need to configure this for
+your needs by editing the conf.py and index.rst files.
+
+All of the documentation is written using reStructuredText and is meant to be
+built Sphinx, a python documentation system built on top of ReST. As of Python
+2.6, Sphinx is the default docuentation system for Python itself, and it is
+becoming rapidly adopted by multiple projects.
+
+This directory contains:
+
+* index.rst - the top level include document for your project.
+
+* conf.py - the sphinx configuration file. You need to edit this file to set
+ your project name, authors, etc.
+
+* Makefile - just type 'make' to see a list of available targets.
+
+* model - A directory for a mock document describing a model. Be sure to see
+ the cheat sheet file "model/sphinx_helpers.rst".
+
+* simulations - A directory for another mock part of your project.
+
+* pyplots - a directory with matplotlib scripts to generate figures that can be
+ included in your document with the 'plot' directive. See the
+ sphinx_helpers.rst file for details.
+
+* tools - a directory that contains:
+
+ * sphinxext - some extensions to sphinx to handle math, ipython syntax
+ highlighting, autodocs.
+
+ * static - directory where you can put your static content, meant to be
+ copied on output by Sphinx into the top-level _static directory. This is
+ never overwritten, so you can keep static CSS files, etc here, that can
+ then override the Sphinx ones.
+
+ * templates - directory for your own templates, also used by sphinx.
+
+
+Note: The makefile and sphinx build system create three directories when
+bulding the output, named ``build``, ``dist`` and ``_static``. Do *not* make
+directories with these names as part of your project, to avoid possible
+conflicts.
+
+
+You can get the latest svn of this document with::
+
+ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/py4science/examples/sphinx_template2
Added: trunk/py4science/examples/sphinx_template2/conf.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/conf.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/conf.py 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,177 @@
+# -*- coding: utf-8 -*-
+#
+# sampledoc documentation build configuration file, created by
+# sphinx-quickstart on Tue Jun 3 12:40:24 2008.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default value; values that are commented out
+# serve to show the default value.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+sys.path.append(os.path.abspath('tools/sphinxext'))
+
+
+# Import support for ipython console session syntax highlighting (lives
+# in the sphinxext directory defined above)
+import ipython_console_highlighting
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = [#'mathmpl',
+ 'ipython_console_highlighting', 'sphinx.ext.autodoc',
+ 'inheritance_diagram', 'only_directives', 'plot_directive',
+ 'sphinx.ext.pngmath',
+ ]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['tools/templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General substitutions.
+project = 'sampledoc'
+copyright = '2008, John D. Hunter, Cast of Thousands'
+
+# The default replacements for |version| and |release|, also used in various
+# other places throughout the built documents.
+#
+# The short X.Y version.
+version = '0.2'
+# The full version, including alpha/beta/rc tags.
+release = '0.2'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directories, that shouldn't be
+# searched for source files.
+#exclude_dirs = []
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# The name of an image file (within the static path) to place at the top of
+# the sidebar.
+#html_logo = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['tools/static','_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = project
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples (source start
+# file, target name, title, author, document class [howto/manual]).
+
+main_manual_tex = project + '.tex'
+
+latex_documents = [
+ (master_doc,
+ main_manual_tex,
+ 'sampledoc Documentation',
+ 'John D. Hunter, Cast of Thousands',
+ 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
Added: trunk/py4science/examples/sphinx_template2/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/index.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/index.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,25 @@
+.. sampledoc documentation master file
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to sampledoc's documentation!
+=====================================
+
+.. htmlonly::
+
+ :Release: |version|
+ :Date: |today|
+
+.. toctree::
+ :maxdepth: 2
+
+ model/index.rst
+ simulations/index.rst
+
+
+.. htmlonly::
+
+ * :ref:`genindex`
+ * :ref:`modindex`
+ * :ref:`search`
+
Added: trunk/py4science/examples/sphinx_template2/model/api_docs.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/model/api_docs.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/model/api_docs.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,16 @@
+.. _samplecode-api:
+
+**************
+Samplecode API
+**************
+
+It is easy to autodocument API code if the code has REST docstrings
+using the sphinx `autodoc <http://sphinx.pocoo.org/ext/autodoc.html>`_
+facilities.
+
+:mod:`matplotlib.backend_bases`
+================================
+
+.. automodule:: matplotlib.backend_bases
+ :members:
+ :undoc-members:
Added: trunk/py4science/examples/sphinx_template2/model/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/model/index.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/model/index.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,13 @@
+.. _model-index:
+
+================
+ My Fancy Model
+================
+
+.. toctree::
+
+ introduction.rst
+ next_steps.rst
+ sphinx_helpers.rst
+ api_docs.rst
+
\ No newline at end of file
Added: trunk/py4science/examples/sphinx_template2/model/introduction.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/model/introduction.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/model/introduction.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,30 @@
+.. _model-introduction:
+
+******************
+Model Introduction
+******************
+
+Wherein I describe my fancy model :math:`E=MC^2`
+and also
+
+.. math::
+
+ \frac{5 - \frac{1}{x}}{4}
+
+For more details, see :ref:`using-math`.
+
+.. _other-models:
+
+Other Models
+============
+
+Where in I describe
+
+* model A
+
+* model B
+
+* model C
+
+and why they all suck
+
Added: trunk/py4science/examples/sphinx_template2/model/next_steps.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/model/next_steps.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/model/next_steps.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,8 @@
+.. _next-steps:
+
+**********
+Next steps
+**********
+
+Wherein I describe my next steps
+
Added: trunk/py4science/examples/sphinx_template2/model/sphinx_helpers.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/model/sphinx_helpers.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/model/sphinx_helpers.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,220 @@
+.. _sphinx_helpers:
+
+******************
+Sphinx Cheat Sheet
+******************
+
+Wherein I show by example how to do some things in Sphinx (you can see
+a literal version of this file below in :ref:`sphinx-literal`)
+
+
+.. _making-a-list:
+
+Making a list
+=============
+
+It is easy to make lists in rest
+
+Bullet points
+-------------
+
+This is a subsection making bullet points
+
+* point A
+
+* point B
+
+* point C
+
+
+Enumerated points
+------------------
+
+This is a subsection making numbered points
+
+#. point A
+
+#. point B
+
+#. point C
+
+
+.. _making-a-table:
+
+Making a table
+==============
+
+This shows you how to make a table -- if you only want to make a list see :ref:`making-a-list`.
+
+================== ============
+Name Age
+================== ============
+John D Hunter 40
+Cast of Thousands 41
+And Still More 42
+================== ============
+
+.. _making-links:
+
+Making links
+============
+
+It is easy to make a link to `yahoo <http://yahoo.com>`_ or to some
+section inside this document (see :ref:`making-a-table`) or another
+document (see :ref:`final-results`).
+
+You can also reference classes, modules, functions, etc that are
+documented using the sphinx `autodoc
+<http://sphinx.pocoo.org/ext/autodoc.html>`_ facilites. For example,
+see the module :mod:`matplotlib.backend_bases` documentation, or the
+class :class:`~matplotlib.backend_bases.LocationEvent`, or the method
+:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect`.
+
+.. _ipython-highlighting:
+
+ipython sessions
+================
+
+Michael Droettboom contributed a sphinx extension which does pygments
+syntax highlighting on ipython sessions
+
+.. sourcecode:: ipython
+
+ In [69]: lines = plot([1,2,3])
+
+ In [70]: setp(lines)
+ alpha: float
+ animated: [True | False]
+ antialiased or aa: [True | False]
+ ...snip
+
+This support is included in this template, but will also be included
+in a future version of Pygments by default.
+
+.. _formatting-text:
+
+Formatting text
+===============
+
+You use inline markup to make text *italics*, **bold**, or ``monotype``.
+
+You can represent code blocks fairly easily::
+
+ import numpy as np
+ x = np.random.rand(12)
+
+Or literally include code:
+
+.. literalinclude:: ../pyplots/elegant.py
+
+
+.. _using-math:
+
+Using math
+==========
+
+In sphinx you can include inline math :math:`x\leftarrow y\ x\forall
+y\ x-y` or display math
+
+.. math::
+
+ W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]
+
+This documentation framework includes a Sphinx extension,
+:file:`sphinxext/mathmpl.py`, that uses matplotlib to render math
+equations when generating HTML, and LaTeX itself when generating a
+PDF. This can be useful on systems that have matplotlib, but not
+LaTeX, installed. To use it, add ``mathmpl`` to the list of
+extensions in :file:`conf.py`.
+
+Current SVN versions of Sphinx now include built-in support for math.
+There are two flavors:
+
+ - pngmath: uses dvipng to render the equation
+
+ - jsmath: renders the math in the browser using Javascript
+
+To use these extensions instead, add ``sphinx.ext.pngmath`` or
+``sphinx.ext.jsmath`` to the list of extensions in :file:`conf.py`.
+
+All three of these options for math are designed to behave in the same
+way.
+
+.. _emacs-helpers:
+
+Inserting matplotlib plots
+==========================
+
+Inserting automatically-generated plots is easy. Simply put the
+script to generate the plot in the :file:`pyplots` directory, and
+refer to it using the ``plot`` directive. To include the source code
+for the plot in the document, pass the ``include-source`` parameter::
+
+ .. plot:: ../pyplots/elegant.py
+ :include-source:
+
+In the HTML version of the document, the plot includes links to the
+original source code, a high-resolution PNG and a PDF. In the PDF
+version of the document, the plot is included as a scalable PDF.
+
+.. plot:: ../pyplots/elegant.py
+ :include-source:
+
+Inheritance diagrams
+====================
+
+Inheritance diagrams can be inserted directly into the document by
+providing a list of class or module names to the
+``inheritance-diagram`` directive.
+
+For example::
+
+ .. inheritance-diagram:: codecs
+
+produces:
+
+.. inheritance-diagram:: codecs
+
+Emacs helpers
+=============
+
+There is an emacs mode `rst.el
+<http://docutils.sourceforge.net/tools/editors/emacs/rst.el>`_ which
+automates many important ReST tasks like building and updateing
+table-of-contents, and promoting or demoting section headings. Here
+is the basic ``.emacs`` configuration::
+
+ (require 'rst)
+ (setq auto-mode-alist
+ (append '(("\\.txt$" . rst-mode)
+ ("\\.rst$" . rst-mode)
+ ("\\.rest$" . rst-mode)) auto-mode-alist))
+
+
+Some helpful functions::
+
+ C-c TAB - rst-toc-insert
+
+ Insert table of contents at point
+
+ C-c C-u - rst-toc-update
+
+ Update the table of contents at point
+
+ C-c C-l rst-shift-region-left
+
+ Shift region to the left
+
+ C-c C-r rst-shift-region-right
+
+ Shift region to the right
+
+
+.. _sphinx-literal:
+
+This file
+=========
+
+.. literalinclude:: sphinx_helpers.rst
+
+
Added: trunk/py4science/examples/sphinx_template2/pyplots/elegant.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/pyplots/elegant.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/pyplots/elegant.py 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,4 @@
+import matplotlib.pyplot as plt
+plt.plot([1,2,3], [4,5,6])
+plt.ylabel('some more numbers')
+
Added: trunk/py4science/examples/sphinx_template2/pyplots/hairy.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/pyplots/hairy.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/pyplots/hairy.py 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,4 @@
+import matplotlib.pyplot as plt
+plt.plot([1,2,3])
+plt.ylabel('some numbers')
+
Added: trunk/py4science/examples/sphinx_template2/simulations/finale.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/simulations/finale.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/simulations/finale.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,12 @@
+.. _final-results:
+
+*************
+Final Results
+*************
+
+
+After much head scratching, I wrote this big elegant piece of code, to
+produce this much more elegant figure:
+
+.. plot:: ../pyplots/elegant.py
+ :include-source:
Added: trunk/py4science/examples/sphinx_template2/simulations/index.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/simulations/index.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/simulations/index.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,11 @@
+.. _simulations-index:
+
+===========================
+ My Stupendous Simulations
+===========================
+
+.. toctree::
+
+ introduction.rst
+ preliminary.rst
+ finale.rst
Added: trunk/py4science/examples/sphinx_template2/simulations/introduction.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/simulations/introduction.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/simulations/introduction.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,24 @@
+.. _simulations-introduction:
+
+********************
+Simulations overview
+********************
+
+Wherein I describe my fancy code and libraries to implement my fancy model (:ref:`model-introduction`)
+
+.. _python-libraries:
+
+The python libraries
+====================
+
+Why `matplotlib <http://matplotlib.sf.net>`_ rules
+
+.. _data-sources:
+
+The data sources
+====================
+
+Now how much would you pay?
+
+
+
Added: trunk/py4science/examples/sphinx_template2/simulations/preliminary.rst
===================================================================
--- trunk/py4science/examples/sphinx_template2/simulations/preliminary.rst (rev 0)
+++ trunk/py4science/examples/sphinx_template2/simulations/preliminary.rst 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,11 @@
+.. _preliminary-tests:
+
+*****************
+Preliminary tests
+*****************
+
+I wrote this big hairy piece of code to make the following plot:
+
+.. plot:: ../pyplots/hairy.py
+ :include-source:
+
Added: trunk/py4science/examples/sphinx_template2/tools/sphinxext/inheritance_diagram.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/tools/sphinxext/inheritance_diagram.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/tools/sphinxext/inheritance_diagram.py 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,458 @@
+"""
+Defines a docutils directive for inserting inheritance diagrams.
+
+Provide the directive with one or more classes or modules (separated
+by whitespace). For modules, all of the classes in that module will
+be used.
+
+Example::
+
+ Given the following classes:
+
+ class A: pass
+ class B(A): pass
+ class C(A): pass
+ class D(B, C): pass
+ class E(B): pass
+
+ .. inheritance-diagram: D E
+
+ Produces a graph like the following:
+
+ A
+ / \
+ B C
+ / \ /
+ E D
+
+The graph is inserted as a PNG+image map into HTML and a PDF in
+LaTeX.
+"""
+
+#-----------------------------------------------------------------------------
+# Module and package imports
+
+# From the standard library
+
+import inspect
+import os
+import re
+import subprocess
+
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
+# Third party
+from docutils.nodes import Body, Element
+from docutils.writers.html4css1 import HTMLTranslator
+from docutils.parsers.rst import directives
+
+from sphinx.latexwriter import LaTeXTranslator
+from sphinx.roles import xfileref_role
+
+#-----------------------------------------------------------------------------
+# Global Constants
+# Sphinx automatically copies out the contents of this directory to the html
+# output, so by putting things in here they get correctly picked up in the end
+STATIC_DIR='_static'
+
+options_spec = {
+ 'parts': directives.nonnegative_int
+ }
+
+#-----------------------------------------------------------------------------
+# Main code begins, classes and functions
+
+class DotException(Exception):
+ pass
+
+class InheritanceGraph(object):
+ """
+ Given a list of classes, determines the set of classes that
+ they inherit from all the way to the root "object", and then
+ is able to generate a graphviz dot graph from them.
+ """
+ def __init__(self, class_names, show_builtins=False):
+ """
+ *class_names* is a list of child classes to show bases from.
+
+ If *show_builtins* is True, then Python builtins will be shown
+ in the graph.
+ """
+ self.class_names = class_names
+ self.classes = self._import_classes(class_names)
+ self.all_classes = self._all_classes(self.classes)
+ if len(self.all_classes) == 0:
+ raise ValueError("No classes found for inheritance diagram")
+ self.show_builtins = show_builtins
+
+ py_sig_re = re.compile(r'''^([\w.]*\.)? # class names
+ (\w+) \s* $ # optionally arguments
+ ''', re.VERBOSE)
+
+ def _import_class_or_module(self, name):
+ """
+ Import a class using its fully-qualified *name*.
+ """
+ try:
+ path, base = self.py_sig_re.match(name).groups()
+ except:
+ raise ValueError(
+ "Invalid class or module '%s' specified for inheritance diagram" % name)
+ fullname = (path or '') + base
+ path = (path and path.rstrip('.'))
+ if not path:
+ path = base
+ if not path:
+ raise ValueError(
+ "Invalid class or module '%s' specified for inheritance diagram" % name)
+ try:
+ module = __import__(path, None, None, [])
+ except ImportError:
+ raise ValueError(
+ "Could not import class or module '%s' specified for inheritance diagram" % name)
+
+ try:
+ todoc = module
+ for comp in fullname.split('.')[1:]:
+ todoc = getattr(todoc, comp)
+ except AttributeError:
+ raise ValueError(
+ "Could not find class or module '%s' specified for inheritance diagram" % name)
+
+ # If a class, just return it
+ if inspect.isclass(todoc):
+ return [todoc]
+ elif inspect.ismodule(todoc):
+ classes = []
+ for cls in todoc.__dict__.values():
+ if inspect.isclass(cls) and cls.__module__ == todoc.__name__:
+ classes.append(cls)
+ return classes
+ raise ValueError(
+ "'%s' does not resolve to a class or module" % name)
+
+ def _import_classes(self, class_names):
+ """
+ Import a list of classes.
+ """
+ classes = []
+ for name in class_names:
+ classes.extend(self._import_class_or_module(name))
+ return classes
+
+ def _all_classes(self, classes):
+ """
+ Return a list of all classes that are ancestors of *classes*.
+ """
+ all_classes = {}
+
+ def recurse(cls):
+ all_classes[cls] = None
+ for c in cls.__bases__:
+ if c not in all_classes:
+ recurse(c)
+
+ for cls in classes:
+ recurse(cls)
+
+ return all_classes.keys()
+
+ def class_name(self, cls, parts=0):
+ """
+ Given a class object, return a fully-qualified name. This
+ works for things I've tested in matplotlib so far, but may not
+ be completely general.
+ """
+ module = cls.__module__
+ if module == '__builtin__':
+ fullname = cls.__name__
+ else:
+ fullname = "%s.%s" % (module, cls.__name__)
+ if parts == 0:
+ return fullname
+ name_parts = fullname.split('.')
+ return '.'.join(name_parts[-parts:])
+
+ def get_all_class_names(self):
+ """
+ Get all of the class names involved in the graph.
+ """
+ return [self.class_name(x) for x in self.all_classes]
+
+ # These are the default options for graphviz
+ default_graph_options = {
+ "rankdir": "LR",
+ "size": '"8.0, 12.0"'
+ }
+ default_node_options = {
+ "shape": "box",
+ "fontsize": 10,
+ "height": 0.25,
+ "fontname": "Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",
+ "style": '"setlinewidth(0.5)"'
+ }
+ default_edge_options = {
+ "arrowsize": 0.5,
+ "style": '"setlinewidth(0.5)"'
+ }
+
+ def _format_node_options(self, options):
+ return ','.join(["%s=%s" % x for x in options.items()])
+
+ def _format_graph_options(self, options):
+ return ''.join(["%s=%s;\n" % x for x in options.items()])
+
+ def generate_dot(self, fd, name, parts=0, urls={},
+ graph_options={}, node_options={},
+ edge_options={}):
+ """
+ Generate a graphviz dot graph from the classes that
+ were passed in to __init__.
+
+ *fd* is a Python file-like object to write to.
+
+ *name* is the name of the graph
+
+ *urls* is a dictionary mapping class names to http urls
+
+ *graph_options*, *node_options*, *edge_options* are
+ dictionaries containing key/value pairs to pass on as graphviz
+ properties.
+ """
+ g_options = self.default_graph_options.copy()
+ g_options.update(graph_options)
+ n_options = self.default_node_options.copy()
+ n_options.update(node_options)
+ e_options = self.default_edge_options.copy()
+ e_options.update(edge_options)
+
+ fd.write('digraph %s {\n' % name)
+ fd.write(self._format_graph_options(g_options))
+
+ for cls in self.all_classes:
+ if not self.show_builtins and cls in __builtins__.values():
+ continue
+
+ name = self.class_name(cls, parts)
+
+ # Write the node
+ this_node_options = n_options.copy()
+ url = urls.get(self.class_name(cls))
+ if url is not None:
+ this_node_options['URL'] = '"%s"' % url
+ fd.write(' "%s" [%s];\n' %
+ (name, self._format_node_options(this_node_options)))
+
+ # Write the edges
+ for base in cls.__bases__:
+ if not self.show_builtins and base in __builtins__.values():
+ continue
+
+ base_name = self.class_name(base, parts)
+ fd.write(' "%s" -> "%s" [%s];\n' %
+ (base_name, name,
+ self._format_node_options(e_options)))
+ fd.write('}\n')
+
+ def run_dot(self, args, name, parts=0, urls={},
+ graph_options={}, node_options={}, edge_options={}):
+ """
+ Run graphviz 'dot' over this graph, returning whatever 'dot'
+ writes to stdout.
+
+ *args* will be passed along as commandline arguments.
+
+ *name* is the name of the graph
+
+ *urls* is a dictionary mapping class names to http urls
+
+ Raises DotException for any of the many os and
+ installation-related errors that may occur.
+ """
+ try:
+ dot = subprocess.Popen(['dot'] + list(args),
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ close_fds=True)
+ except OSError:
+ raise DotException("Could not execute 'dot'. Are you sure you have 'graphviz' installed?")
+ except ValueError:
+ raise DotException("'dot' called with invalid arguments")
+ except:
+ raise DotException("Unexpected error calling 'dot'")
+
+ self.generate_dot(dot.stdin, name, parts, urls, graph_options,
+ node_options, edge_options)
+ dot.stdin.close()
+ result = dot.stdout.read()
+ returncode = dot.wait()
+ if returncode != 0:
+ raise DotException("'dot' returned the errorcode %d" % returncode)
+ return result
+
+
+class inheritance_diagram(Body, Element):
+ """
+ A docutils node to use as a placeholder for the inheritance
+ diagram.
+ """
+ pass
+
+
+def inheritance_diagram_directive_run(class_names, options, state):
+ """
+ Run when the inheritance_diagram directive is first encountered.
+ """
+ node = inheritance_diagram()
+
+ # Create a graph starting with the list of classes
+ graph = InheritanceGraph(class_names)
+
+ # Create xref nodes for each target of the graph's image map and
+ # add them to the doc tree so that Sphinx can resolve the
+ # references to real URLs later. These nodes will eventually be
+ # removed from the doctree after we're done with them.
+ for name in graph.get_all_class_names():
+ refnodes, x = xfileref_role(
+ 'class', ':class:`%s`' % name, name, 0, state)
+ node.extend(refnodes)
+ # Store the graph object so we can use it to generate the
+ # dot file later
+ node['graph'] = graph
+ # Store the original content for use as a hash
+ node['parts'] = options.get('parts', 0)
+ node['content'] = " ".join(class_names)
+ return [node]
+
+
+def get_graph_hash(node):
+ return md5(node['content'] + str(node['parts'])).hexdigest()[-10:]
+
+
+def html_output_graph(self, node):
+ """
+ Output the graph for HTML. This will insert a PNG with clickable
+ image map.
+ """
+ graph = node['graph']
+ parts = node['parts']
+
+ graph_hash = get_graph_hash(node)
+ name = "inheritance%s" % graph_hash
+ png_path = os.path.join(STATIC_DIR, name + ".png")
+
+ path = STATIC_DIR
+ source = self.document.attributes['source']
+ count = source.split('/doc/')[-1].count('/')
+ for i in range(count):
+ if os.path.exists(path): break
+ path = '../'+path
+ path = '../'+path #specifically added for matplotlib
+
+ # Create a mapping from fully-qualified class names to URLs.
+ urls = {}
+ for child in node:
+ if child.get('refuri') is not None:
+ urls[child['reftitle']] = child.get('refuri')
+ elif child.get('refid') is not None:
+ urls[child['reftitle']] = '#' + child.get('refid')
+
+ # These arguments to dot will save a PNG file to disk and write
+ # an HTML image map to stdout.
+ image_map = graph.run_dot(['-Tpng', '-o%s' % png_path, '-Tcmapx'],
+ name, parts, urls)
+ return ('<img src="%s/%s.png" usemap="#%s" class="inheritance"/>%s' %
+ (path, name, name, image_map))
+
+
+def latex_output_graph(self, node):
+ """
+ Output the graph for LaTeX. This will insert a PDF.
+ """
+ graph = node['graph']
+ parts = node['parts']
+
+ graph_hash = get_graph_hash(node)
+ name = "inheritance%s" % graph_hash
+ pdf_path = os.path.join(STATIC_DIR, name + ".pdf")
+
+ graph.run_dot(['-Tpdf', '-o%s' % pdf_path],
+ name, parts, graph_options={'size': '"6.0,6.0"'})
+ return '\\includegraphics{../../%s}' % pdf_path
+
+
+def visit_inheritance_diagram(inner_func):
+ """
+ This is just a wrapper around html/latex_output_graph to make it
+ easier to handle errors and insert warnings.
+ """
+ def visitor(self, node):
+ try:
+ content = inner_func(self, node)
+ except DotException, e:
+ # Insert the exception as a warning in the document
+ warning = self.document.reporter.warning(str(e), line=node.line)
+ warning.parent = node
+ node.children = [warning]
+ else:
+ source = self.document.attributes['source']
+ self.body.append(content)
+ node.children = []
+ return visitor
+
+
+def do_nothing(self, node):
+ pass
+
+
+def setup(app):
+ app.add_node(inheritance_diagram)
+
+ HTMLTranslator.visit_inheritance_diagram = \
+ visit_inheritance_diagram(html_output_graph)
+ HTMLTranslator.depart_inheritance_diagram = do_nothing
+
+ LaTeXTranslator.visit_inheritance_diagram = \
+ visit_inheritance_diagram(latex_output_graph)
+ LaTeXTranslator.depart_inheritance_diagram = do_nothing
+
+#-----------------------------------------------------------------------------
+# Main code - register the directives. Do it in a way that's compatible with
+# the old and current docutils APIs.
+
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ # Legacy API
+ from docutils.parsers.rst.directives import _directives
+
+ def inheritance_diagram_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state,
+ state_machine):
+ return inheritance_diagram_directive_run(arguments, options, state)
+
+ inheritance_diagram_directive.__doc__ = __doc__
+ inheritance_diagram_directive.arguments = (1, 100, 0)
+ inheritance_diagram_directive.options = options_spec
+ inheritance_diagram_directive.content = 0
+ _directives['inheritance-diagram'] = inheritance_diagram_directive
+
+else:
+ # New API
+ class inheritance_diagram_directive(Directive):
+ has_content = False
+ required_arguments = 1
+ optional_arguments = 100
+ final_argument_whitespace = False
+ option_spec = options_spec
+
+ def run(self):
+ return inheritance_diagram_directive_run(
+ self.arguments, self.options, self.state)
+
+ inheritance_diagram_directive.__doc__ = __doc__
+
+ directives.register_directive('inheritance-diagram',
+ inheritance_diagram_directive)
Added: trunk/py4science/examples/sphinx_template2/tools/sphinxext/ipython_console_highlighting.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/tools/sphinxext/ipython_console_highlighting.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/tools/sphinxext/ipython_console_highlighting.py 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,98 @@
+"""reST directive for syntax-highlighting ipython interactive sessions.
+"""
+
+#-----------------------------------------------------------------------------
+# Needed modules
+
+# Standard library
+import re
+
+# Third party
+from pygments.lexer import Lexer, do_insertions
+from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
+ PythonTracebackLexer)
+from pygments.token import Comment, Generic
+
+from sphinx import highlighting
+
+
+#-----------------------------------------------------------------------------
+# Global constants
+line_re = re.compile('.*?\n')
+
+#-----------------------------------------------------------------------------
+# Code begins - classes and functions
+
+class IPythonConsoleLexer(Lexer):
+ """
+ For IPython console output or doctests, such as:
+
+ .. sourcecode:: ipython
+
+ In [1]: a = 'foo'
+
+ In [2]: a
+ Out[2]: 'foo'
+
+ In [3]: print a
+ foo
+
+ In [4]: 1 / 0
+
+ Notes:
+
+ - Tracebacks are not currently supported.
+
+ - It assumes the default IPython prompts, not customized ones.
+ """
+
+ name = 'IPython console session'
+ aliases = ['ipython']
+ mimetypes = ['text/x-ipython-console']
+ input_prompt = re.compile("(In \[[0-9]+\]: )|( \.\.\.+:)")
+ output_prompt = re.compile("(Out\[[0-9]+\]: )|( \.\.\.+:)")
+ continue_prompt = re.compile(" \.\.\.+:")
+ tb_start = re.compile("\-+")
+
+ def get_tokens_unprocessed(self, text):
+ pylexer = PythonLexer(**self.options)
+ tblexer = PythonTracebackLexer(**self.options)
+
+ curcode = ''
+ insertions = []
+ for match in line_re.finditer(text):
+ line = match.group()
+ input_prompt = self.input_prompt.match(line)
+ continue_prompt = self.continue_prompt.match(line.rstrip())
+ output_prompt = self.output_prompt.match(line)
+ if line.startswith("#"):
+ insertions.append((len(curcode),
+ [(0, Comment, line)]))
+ elif input_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt, input_prompt.group())]))
+ curcode += line[input_prompt.end():]
+ elif continue_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt, continue_prompt.group())]))
+ curcode += line[continue_prompt.end():]
+ elif output_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Output, output_prompt.group())]))
+ curcode += line[output_prompt.end():]
+ else:
+ if curcode:
+ for item in do_insertions(insertions,
+ pylexer.get_tokens_unprocessed(curcode)):
+ yield item
+ curcode = ''
+ insertions = []
+ yield match.start(), Generic.Output, line
+ if curcode:
+ for item in do_insertions(insertions,
+ pylexer.get_tokens_unprocessed(curcode)):
+ yield item
+
+#-----------------------------------------------------------------------------
+# Register the extension as a valid pygments lexer
+highlighting.lexers['ipython'] = IPythonConsoleLexer()
Added: trunk/py4science/examples/sphinx_template2/tools/sphinxext/mathmpl.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/tools/sphinxext/mathmpl.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/tools/sphinxext/mathmpl.py 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,166 @@
+"""matplotlib-based directive for math rendering in reST using sphinx.
+
+To use this extension, add ``mathmpl`` to the list of extensions in
+:file:`conf.py`.
+
+*Warning*: this code is currently untested. ***MAY NOT WORK***
+
+Note:
+
+Current SVN versions of Sphinx now include built-in support for math.
+There are two flavors:
+
+ - pngmath: uses dvipng to render the equation
+
+ - jsmath: renders the math in the browser using Javascript
+
+To use these extensions instead of the code in this module, add
+``sphinx.ext.pngmath`` or ``sphinx.ext.jsmath`` to the list of extensions in
+:file:`conf.py`.
+
+All three of these options for math are designed to behave in the same
+way.
+"""
+
+import os
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
+from docutils import nodes
+from docutils.parsers.rst import directives
+from docutils.writers.html4css1 import HTMLTranslator
+from sphinx.latexwriter import LaTeXTranslator
+import warnings
+
+# Constants
+STATIC_DIR='_static'
+
+# Define LaTeX math node:
+class latex_math(nodes.General, nodes.Element):
+ pass
+
+def fontset_choice(arg):
+ return directives.choice(arg, ['cm', 'stix', 'stixsans'])
+
+options_spec = {'fontset': fontset_choice}
+
+def math_role(role, rawtext, text, lineno, inliner,
+ options={}, content=[]):
+ i = rawtext.find('`')
+ latex = rawtext[i+1:-1]
+ node = latex_math(rawtext)
+ node['latex'] = latex
+ node['fontset'] = options.get('fontset', 'cm')
+ return [node], []
+math_role.options = options_spec
+
+def math_directive_run(content, block_text, options):
+ latex = ''.join(content)
+ node = latex_math(block_text)
+ node['latex'] = latex
+ node['fontset'] = options.get('fontset', 'cm')
+ return [node]
+
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ # Register directive the old way:
+ from docutils.parsers.rst.directives import _directives
+ def math_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ return math_directive_run(content, block_text, options)
+ math_directive.arguments = None
+ math_directive.options = options_spec
+ math_directive.content = 1
+ _directives['math'] = math_directive
+else:
+ class math_directive(Directive):
+ has_content = True
+ option_spec = options_spec
+
+ def run(self):
+ return math_directive_run(self.content, self.block_text,
+ self.options)
+ from docutils.parsers.rst import directives
+ directives.register_directive('math', math_directive)
+
+def setup(app):
+ app.add_node(latex_math)
+ app.add_role('math', math_role)
+
+ # Add visit/depart methods to HTML-Translator:
+ def visit_latex_math_html(self, node):
+ source = self.document.attributes['source']
+ self.body.append(latex2html(node, source))
+ def depart_latex_math_html(self, node):
+ pass
+ HTMLTranslator.visit_latex_math = visit_latex_math_html
+ HTMLTranslator.depart_latex_math = depart_latex_math_html
+
+ # Add visit/depart methods to LaTeX-Translator:
+ def visit_latex_math_latex(self, node):
+ inline = isinstance(node.parent, nodes.TextElement)
+ if inline:
+ self.body.append('$%s$' % node['latex'])
+ else:
+ self.body.extend(['\\begin{equation}',
+ node['latex'],
+ '\\end{equation}'])
+ def depart_latex_math_latex(self, node):
+ pass
+ LaTeXTranslator.visit_latex_math = visit_latex_math_latex
+ LaTeXTranslator.depart_latex_math = depart_latex_math_latex
+
+from matplotlib import rcParams
+from matplotlib.mathtext import MathTextParser
+rcParams['mathtext.fontset'] = 'cm'
+mathtext_parser = MathTextParser("Bitmap")
+
+
+# This uses mathtext to render the expression
+def latex2png(latex, filename, fontset='cm'):
+ latex = "$%s$" % latex
+ orig_fontset = rcParams['mathtext.fontset']
+ rcParams['mathtext.fontset'] = fontset
+ if os.path.exists(filename):
+ depth = mathtext_parser.get_depth(latex, dpi=100)
+ else:
+ print latex.encode("ascii", "backslashreplace")
+ try:
+ depth = mathtext_parser.to_png(filename, latex, dpi=100)
+ except:
+ warnings.warn("Could not render math expression %s" % latex,
+ Warning)
+ depth = 0
+ rcParams['mathtext.fontset'] = orig_fontset
+ return depth
+
+# LaTeX to HTML translation stuff:
+def latex2html(node, source):
+ inline = isinstance(node.parent, nodes.TextElement)
+ latex = node['latex']
+ name = 'math-%s' % md5(latex).hexdigest()[-10:]
+ dest = os.path.join(STATIC_DIR, name + ".png")
+
+ depth = latex2png(latex, dest, node.get('fontset',
+ rcParams['mathtext.fontset']))
+
+ path = STATIC_DIR
+ count = source.split('/doc/')[-1].count('/')
+ for i in range(count):
+ if os.path.exists(path): break
+ path = '../'+path
+ path = '../'+path #specifically added for matplotlib
+ if inline:
+ cls = ''
+ else:
+ cls = 'class="center" '
+ if inline and depth != 0:
+ style = 'style="position: relative; bottom: -%dpx"' % (depth + 1)
+ else:
+ style = ''
+
+ return '<img src="%s/%s.png" %s%s/>' % (path, name, cls, style)
+
Added: trunk/py4science/examples/sphinx_template2/tools/sphinxext/only_directives.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/tools/sphinxext/only_directives.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/tools/sphinxext/only_directives.py 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,101 @@
+"""reST directives for selective inclusion of contents.
+
+A pair of directives for inserting content that will only appear in
+either html or latex.
+"""
+
+#-----------------------------------------------------------------------------
+# Needed packages and modules
+
+
+from docutils.nodes import Body, Element
+from docutils.writers.html4css1 import HTMLTranslator
+
+from sphinx.latexwriter import LaTeXTranslator
+
+from docutils.parsers.rst import directives
+
+
+#-----------------------------------------------------------------------------
+# Code begins
+class html_only(Body, Element):
+ pass
+
+class latex_only(Body, Element):
+ pass
+
+def run(content, node_class, state, content_offset):
+ text = '\n'.join(content)
+ node = node_class(text)
+ state.nested_parse(content, content_offset, node)
+ return [node]
+
+def setup(app):
+ app.add_node(html_only)
+ app.add_node(latex_only)
+
+ # Add visit/depart methods to HTML-Translator:
+ def visit_perform(self, node):
+ pass
+ def depart_perform(self, node):
+ pass
+ def visit_ignore(self, node):
+ node.children = []
+ def depart_ignore(self, node):
+ node.children = []
+
+ HTMLTranslator.visit_html_only = visit_perform
+ HTMLTranslator.depart_html_only = depart_perform
+ HTMLTranslator.visit_latex_only = visit_ignore
+ HTMLTranslator.depart_latex_only = depart_ignore
+
+ LaTeXTranslator.visit_html_only = visit_ignore
+ LaTeXTranslator.depart_html_only = depart_ignore
+ LaTeXTranslator.visit_latex_only = visit_perform
+ LaTeXTranslator.depart_latex_only = depart_perform
+
+# Register the directives with code for both the legacy and the new docutils
+# APIs.
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ # Legacy API
+ from docutils.parsers.rst.directives import _directives
+
+ def html_only_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ return run(content, html_only, state, content_offset)
+
+ def latex_only_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ return run(content, latex_only, state, content_offset)
+
+ for func in (html_only_directive, latex_only_directive):
+ func.content = 1
+ func.options = {}
+ func.arguments = None
+
+ _directives['htmlonly'] = html_only_directive
+ _directives['latexonly'] = latex_only_directive
+else:
+ # New docutils directive API
+ class OnlyDirective(Directive):
+ has_content = True
+ required_arguments = 0
+ optional_arguments = 0
+ final_argument_whitespace = True
+ option_spec = {}
+
+ def run(self):
+ self.assert_has_content()
+ return run(self.content, self.node_class,
+ self.state, self.content_offset)
+
+ class HtmlOnlyDirective(OnlyDirective):
+ node_class = html_only
+
+ class LatexOnlyDirective(OnlyDirective):
+ node_class = latex_only
+
+ directives.register_directive('htmlonly', HtmlOnlyDirective)
+ directives.register_directive('latexonly', LatexOnlyDirective)
Added: trunk/py4science/examples/sphinx_template2/tools/sphinxext/plot_directive.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/tools/sphinxext/plot_directive.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/tools/sphinxext/plot_directive.py 2008-10-08 04:07:21 UTC (rev 6167)
@@ -0,0 +1,208 @@
+"""A special directive for including a matplotlib plot.
+
+Given a path to a .py file, it includes the source code inline, then:
+
+- On HTML, will include a .png with a link to a high-res .png.
+
+- On LaTeX, will include a .pdf
+
+This directive supports all of the options of the `image` directive,
+except for `target` (since plot will add its own target).
+
+Additionally, if the :include-source: option is provided, the literal
+source will be included inline, as well as a link to the source.
+"""
+
+#-----------------------------------------------------------------------------
+# Modules
+
+# Stdlib imports
+import glob
+import os
+import shutil
+import sys
+
+from os import path
+
+# Third-party imports
+from docutils.parsers.rst import directives
+
+try:
+ # docutils 0.4
+ from docutils.parsers.rst.directives.images import align
+except ImportError:
+ # docutils 0.5
+ from docutils.parsers.rst.directives.images import Image
+ align = Image.align
+
+# Congigure matplotlib to only use a non-gui backend for image generations
+import matplotlib
+matplotlib.use('Agg')
+import matplotlib.pyplot as plt
+
+import IPython.Shell
+
+#-----------------------------------------------------------------------------
+# Global constants
+
+# Make an IPython instance to run scripts
+mplshell = IPython.Shell.MatplotlibShell('mpl')
+
+# HTML generation options
+options = {'alt': directives.unchanged,
+ 'height': directives.length_or_unitless,
+ 'width': directives.length_or_percentage_or_unitless,
+ 'scale': directives.nonnegative_int,
+ 'align': align,
+ 'class': directives.class_option,
+ 'include-source': directives.flag }
+
+template = """
+.. htmlonly::
+
+ [`source code <../%(outdir)s/%(basename)s.py>`__,
+ `png <../%(outdir)s/%(basename)s.hires.png>`__,
+ `pdf <../%(outdir)s/%(basename)s.pdf>`__]
+
+ .. image:: ../%(outdir)s/%(basename)s.png
+%(options)s
+
+.. latexonly::
+ .. image:: ../%(outdir)s/%(basename)s.pdf
+%(options)s
+
+"""
+
+# XXX - we're abusing things a bit by dumping all output files into the
+# top-level static direcotry that sphinx uses. Ideally we should create our
+# own and populate it with a hierarchy similar to that of the inputs, to avoid
+# possible name clashes from figures with identical names that originally
+# existed in different directories.
+static_dir = '_static'
+
+#-----------------------------------------------------------------------------
+# Code begins
+
+def makefig(fullpath, outdir):
+ """
+ run a pyplot script and save the low and high res PNGs and a PDF in outdir
+ """
+
+ # Resolutions for each formats (passed as dpi= to savefig call)
+ formats = [('png', 100),
+ ('hires.png', 200),
+ ('pdf', 72),
+ ]
+
+ fullpath = str(fullpath) # todo, why is unicode breaking this
+ basedir, fname = os.path.split(fullpath)
+ basename, ext = os.path.splitext(fname)
+ all_exists = True
+
+ if basedir != outdir:
+ shutil.copyfile(fullpath, os.path.join(outdir, fname))
+
+ for format, dpi in formats:
+ outname = os.path.join(outdir, '%s.%s' % (basename, format))
+ if not os.path.exists(outname):
+ all_exists = False
+ break
+
+ if all_exists:
+ print ' already have %s' % fullpath
+ return
+
+ print ' building %s' % fullpath
+
+ # we need to clear between runs
+ plt.close('all')
+ matplotlib.rcdefaults()
+ # Set a figure size that doesn't overflow typical browser windows
+ matplotlib.rcParams['figure.figsize'] = (6,4)
+
+ # Run the actual script using IPython/mpl shell
+ mplshell.magic_run(fullpath)
+
+ # Generate output files
+ for format, dpi in formats:
+ outname = os.path.join(outdir, '%s.%s' % (basename, format))
+ if os.path.exists(outname): continue
+ plt.savefig(outname, dpi=dpi)
+
+
+def run(arguments, options, state_machine, lineno):
+ """Execution of the docutils plot directive.
+ """
+
+ # Code taken from sphinx - locate the full paths to the included script
+ # Relative filename, as given in the ori...
[truncated message content] |
|
From: Michael D. <md...@st...> - 2008-10-07 16:54:18
|
Sorry. I didn't read carefully enough. That's right -- the "if converter: break" was replaced with "return converter". You're right. This is fine. Mike John Hunter wrote: > On Tue, Oct 7, 2008 at 11:26 AM, Michael Droettboom <md...@st...> wrote: > >> This isn't quite what I was suggesting (and seems to be equivalent to >> the code as before). In the common case where there are no units in the >> data, this will still traverse the entire list. >> >> I think replacing the whole loop with: >> >> converter = self.get_converter(iter(x).next()) >> >> would be even better. (Since lists of data should not be heterogeneous >> anyway...) >> > > Hmm, I don't see how it would traverse the entire list > > for thisx in x: > converter = self.get_converter( thisx ) > return converter > > since it will return after the first element in the loop. I have no > problem with the iter approach, but am not seeing what the problem is > with this usage. > > JDH > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
|
From: Michael D. <md...@st...> - 2008-10-07 16:27:03
|
This isn't quite what I was suggesting (and seems to be equivalent to the code as before). In the common case where there are no units in the data, this will still traverse the entire list. I think replacing the whole loop with: converter = self.get_converter(iter(x).next()) would be even better. (Since lists of data should not be heterogeneous anyway...) Mike jd...@us... wrote: > Revision: 6166 > http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6166&view=rev > Author: jdh2358 > Date: 2008-10-07 15:13:53 +0000 (Tue, 07 Oct 2008) > > Log Message: > ----------- > added michaels unit detection optimization for arrays > > Modified Paths: > -------------- > trunk/matplotlib/lib/matplotlib/units.py > > Modified: trunk/matplotlib/lib/matplotlib/units.py > =================================================================== > --- trunk/matplotlib/lib/matplotlib/units.py 2008-10-07 15:13:13 UTC (rev 6165) > +++ trunk/matplotlib/lib/matplotlib/units.py 2008-10-07 15:13:53 UTC (rev 6166) > @@ -135,7 +135,7 @@ > > for thisx in x: > converter = self.get_converter( thisx ) > - if converter: break > + return converter > > #DISABLED self._cached[idx] = converter > return converter > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Matplotlib-checkins mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
|
From: <jd...@us...> - 2008-10-07 15:16:13
|
Revision: 6165
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6165&view=rev
Author: jdh2358
Date: 2008-10-07 15:13:13 +0000 (Tue, 07 Oct 2008)
Log Message:
-----------
added michaels unit detection optimization for arrays
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/units.py
Modified: trunk/matplotlib/lib/matplotlib/units.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/units.py 2008-10-07 06:31:29 UTC (rev 6164)
+++ trunk/matplotlib/lib/matplotlib/units.py 2008-10-07 15:13:13 UTC (rev 6165)
@@ -43,6 +43,7 @@
units.registry[datetime.date] = DateConverter()
"""
+import numpy as np
from matplotlib.cbook import iterable, is_numlike
class AxisInfo:
@@ -127,6 +128,11 @@
converter = self.get(classx)
if converter is None and iterable(x):
+ # if this is anything but an object array, we'll assume
+ # there are no custom units
+ if isinstance(x, np.ndarray) and x.dtype != np.object:
+ return None
+
for thisx in x:
converter = self.get_converter( thisx )
if converter: break
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|