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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
1
(20) |
2
(5) |
3
(2) |
4
(4) |
5
(14) |
6
(19) |
7
(17) |
8
(14) |
9
(34) |
10
(16) |
11
(1) |
12
(22) |
13
(21) |
14
(36) |
15
(28) |
16
(20) |
17
(23) |
18
(10) |
19
(4) |
20
(16) |
21
(17) |
22
(7) |
23
(6) |
24
(3) |
25
(1) |
26
(27) |
27
(13) |
28
(26) |
29
(10) |
30
(25) |
|
Revision: 4534 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4534&view=rev Author: mdboom Date: 2007年11月30日 12:06:59 -0800 (2007年11月30日) Log Message: ----------- Minor spelling corrections. Modified Paths: -------------- trunk/htdocs/whats_new.html.template Modified: trunk/htdocs/whats_new.html.template =================================================================== --- trunk/htdocs/whats_new.html.template 2007年11月30日 19:55:56 UTC (rev 4533) +++ trunk/htdocs/whats_new.html.template 2007年11月30日 20:06:59 UTC (rev 4534) @@ -7,8 +7,8 @@ versioninfo['0.91.0'] = ( ('enhanced mathtext', """Complete revamp of matplotlib's internal math layout and rendering -engine. Michael Droetboom has improved the TeX parser to -significantly expand it's coverege, and implemeted Knuth's box layout +engine. Michael Droettboom has improved the TeX parser to +significantly expand it's coverage, and implemented Knuth's box layout algorithms. Additionally, the much anticipated <a href=http://www.stixfonts.org/>STIX fonts</a> for math expressions have come online and ship with matplotlib. See a sample of the new mathtext at <a @@ -32,7 +32,7 @@ ('record array support', """New functions for loading, displaying and saving numpy record arrays in <a href=matplotlib.mlab.html>matplotlib.mlab</a>. See for example, <a href=examples/loadrec.py>loadrec.py</a> """), -('pyplot', """Added a module <a href=matplotlib.pyplot.html>matplotlib.pyplot</a> which has all of pylab's plotting functions (eg figure, plot, show, close) but does not import the numpy namepace. This is useful for those who want to use the pylab functionality w/o the namespace clutter. +('pyplot', """Added a module <a href=matplotlib.pyplot.html>matplotlib.pyplot</a> which has all of pylab's plotting functions (eg figure, plot, show, close) but does not import the numpy namespace. This is useful for those who want to use the pylab functionality w/o the namespace clutter. """), ('maskedarray', """Added optional support for the scipy sandbox masked array packaged. Configurable with an rc setting. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4533 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4533&view=rev Author: mdboom Date: 2007年11月30日 11:55:56 -0800 (2007年11月30日) Log Message: ----------- Added mathtext column to backends comparison table. Modified Paths: -------------- trunk/htdocs/backends.html.template Modified: trunk/htdocs/backends.html.template =================================================================== --- trunk/htdocs/backends.html.template 2007年11月30日 19:48:41 UTC (rev 4532) +++ trunk/htdocs/backends.html.template 2007年11月30日 19:55:56 UTC (rev 4533) @@ -28,6 +28,9 @@ rotated text </td> <td align="left" valign="top"> + mathtext + </td> + <td align="left" valign="top"> usetex </td> <td align="left" valign="top"> @@ -62,6 +65,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> <tr> <td align="left" valign="top"> @@ -77,6 +83,9 @@ X </td> <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> </td> <td align="left" valign="top"> @@ -112,6 +121,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> <tr> <td align="left" valign="top"> @@ -124,6 +136,9 @@ ? </td> <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> ? </td> <td align="left" valign="top"> @@ -159,6 +174,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> <tr> <td align="left" valign="top"> @@ -174,6 +192,9 @@ </td> <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> </td> <td align="left" valign="top"> @@ -210,6 +231,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> <tr> <td align="left" valign="top"> @@ -227,6 +251,9 @@ X </td> <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> </td> <td align="left" valign="top"> @@ -261,6 +288,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> <tr> <td align="left" valign="top"> @@ -276,6 +306,9 @@ X </td> <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> </td> <td align="left" valign="top"> @@ -307,6 +340,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> <tr> <td align="left" valign="top"> @@ -330,6 +366,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> <tr> <td align="left" valign="top"> @@ -343,6 +382,9 @@ X </td> <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> </td> <td align="left" valign="top"> @@ -377,6 +419,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> <tr> <td align="left" valign="top"> @@ -406,6 +451,9 @@ <td align="left" valign="top"> </td> + <td align="left" valign="top"> + + </td> </tr> <tr> <td align="left" valign="top"> @@ -429,6 +477,9 @@ <td align="left" valign="top"> X </td> + <td align="left" valign="top"> + X + </td> </tr> </table> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4532 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4532&view=rev Author: mdboom Date: 2007年11月30日 11:48:41 -0800 (2007年11月30日) Log Message: ----------- Fix mathtext in example. Modified Paths: -------------- trunk/matplotlib/examples/text_themes.py Modified: trunk/matplotlib/examples/text_themes.py =================================================================== --- trunk/matplotlib/examples/text_themes.py 2007年11月30日 19:44:55 UTC (rev 4531) +++ trunk/matplotlib/examples/text_themes.py 2007年11月30日 19:48:41 UTC (rev 4532) @@ -17,7 +17,7 @@ plot(t1, f(t1), 'bo', t2, f(t2), 'k') title('Damped exponential decay', font, size='large', color='r') -text(2, 0.65, 'cos(2 pi t) exp(-t)', font, color='k', family='monospace' ) +text(2, 0.65, r'$\cos(2 \pi t) \exp(-t)$', color='k') xlabel('time (s)', font, style='italic') ylabel('voltage (mV)', font) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4531 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4531&view=rev Author: mdboom Date: 2007年11月30日 11:44:55 -0800 (2007年11月30日) Log Message: ----------- Updated some statuses on the goals page. Modified Paths: -------------- trunk/htdocs/goals.txt Modified: trunk/htdocs/goals.txt =================================================================== --- trunk/htdocs/goals.txt 2007年11月30日 19:31:05 UTC (rev 4530) +++ trunk/htdocs/goals.txt 2007年11月30日 19:44:55 UTC (rev 4531) @@ -79,7 +79,10 @@ ******************* sqrt overlines -not started +done + +Arbitrary radicals at a number of different sizes can now be drawn. + ******************* add spacing commands @@ -92,14 +95,8 @@ ******************* embedded mathtext -not started +done -Currently a string is all mathtext or None. To get roman fonts in a -mathtext string you can use \rm. Ideally, we could embed mathtext -expressions in a regular string, ie, strings like <tt>r"Rate constant -5ドル\lambda$"</tt>. Note if you use the text.usetex rc option, then -arbitrary TeX/LaTeX expressions can be used - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Regular text ******************* @@ -108,7 +105,7 @@ done This will allow specification of a font size relative to -an existing font rather than in absolute terms, which will +an existing font rather than in absolute terms, which will make scaling all fonts within a plot simpler. ******************* @@ -141,9 +138,9 @@ done -AGG support appeared in +AGG support appeared in <a href="whats_new.html#0.52-Image_support"> -matplotlib-0.52</a>, Postscript image support in +matplotlib-0.52</a>, Postscript image support in <a href="whats_new.html#0.53-Ported_image_support_to_numarray_and_postscript_backend"> matplotlib-0.53</a>. See <a href="matplotlib.pylab.html#-imshow"> @@ -160,11 +157,11 @@ command. Note you can make other kinds of plots on polar, axes, eg scatter plots, as shown in <a href=examples/polar_scatter.py>polar_scatter.py</a>. See <a -href=screenshots.html#polar_demo>polar screenshot</a>. Some work -remains to be done on making the navigation toolbar behave sanely wih -polar plots. +href=screenshots.html#polar_demo>polar screenshot</a>. Further +enhancements to polar plots, including rotating/zooming, are +implemented in the transforms branch. -******************* +******************* Shared axes done @@ -186,20 +183,21 @@ . Work on automatic labeling of contours is underway. linestyles added in matplotlib-0.72.1. polyfilled contours are planned. -******************* +******************* Log histogram not started ******************* General polygon clipping -not started +mostly done This will be based on agg's <a href=http://www.antigrain.com/demo/index.html#PAGE_DEMO_scanline_boolean>scanline boolean algebra</a>, which does not have the licensing restrictions of the <a href=http://www.cs.man.ac.uk/aig/staff/alan/software>gpc</a> -algorithms. +algorithms. This currently works in the Agg and Pdf backends. On the +transforms branch, it additionally works in the Cairo, Ps and Svg backends. ******************* 2-D vector plots @@ -245,7 +243,7 @@ ******************* Bezier curves, paths -not started +done on transforms branch ******************* 3-D visualization @@ -429,21 +427,11 @@ ******************* SVG backend -almost done +almost done Jared Wahlstrand wrote the SVG backend. As of <a -href="whats_new.html#0.61-svg_fixes">matplotlib-0.61</a> svg has fast -rendering, good layout, image support and font support. Remaining is -mathtext for svg. +href="whats_new.html#0.61-svg_fixes">matplotlib-0.91</a> svg has fast +rendering, good layout, image support, font support and mathtext +support. Support for clipping paths is available on the transforms +branch. -******************* -Paint clipping problems - -very low priority - -The problem resides in the underlying libart package (which -sees little maintenance). -******************* -GD color allocation - -very low priority This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4530 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4530&view=rev Author: mdboom Date: 2007年11月30日 11:31:05 -0800 (2007年11月30日) Log Message: ----------- Lots of updates to bring the website inline with 0.91.1 Modified Paths: -------------- trunk/htdocs/backends.html.template trunk/htdocs/faq.html.template trunk/htdocs/fonts.html.template trunk/htdocs/tutorial.html.template Modified: trunk/htdocs/backends.html.template =================================================================== --- trunk/htdocs/backends.html.template 2007年11月30日 17:39:05 UTC (rev 4529) +++ trunk/htdocs/backends.html.template 2007年11月30日 19:31:05 UTC (rev 4530) @@ -1,25 +1,475 @@ -@header@ +@header@ <h2>matplotlib backends</h2> The matplotlib core graphics routines interact with an abstract renderer and graphics context to allow device independent ouput. -Currently, output to pygtk, wxPython, Tkinter, postscript, -pdf, svg, agg (antigrain geometry) and Cairo are supported. With -not too much effort, you can port matplotlib to your favorite display; -high on my list of priorities are PDF and PIL. If you are interested -in porting to one of these platforms, please contact me!<p> +Currently, output to pygtk, wxPython, Tkinter, postscript, pdf, svg, +agg (antigrain geometry) and Cairo are supported. With not too much +effort, you can port matplotlib to your favorite display. If you are +interested in porting to one of these platforms, please contact the +<a href="http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-devel">matplotlib-devel</a> +mailing list.<p> -For a summary of the comparative strengths and features of the various -backends, see <a href=faq.html#WHICHBACKEND>which backend should I -use?</a>. This page describes how to install and use each backend.<p> - -You can choose your default backend in the <a -href=matplotlibrc>matplotlibrc</a> file. The default can be -overridden from the command line prompt. This allows most if not all -matplotlib scripts can generate output to any of the backends without -any alterations. Following the lead of the matlab <tt>print</tt> -command, the backend can be chosen from the command line with the +<a name="comparision"/><h2>Comparison of backends</h2> + +The following table enumerates the capabilities of the different backends.<p> + +<!-- This HTML table template is generated by emacs 22.1.1 --> +<table border="1"> + <tr bgcolor="#dddddd"> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + output formats + </td> + <td align="left" valign="top"> + rotated text + </td> + <td align="left" valign="top"> + usetex + </td> + <td align="left" valign="top"> + alpha-blending + </td> + <td align="left" valign="top"> + arbitrary clipping<br/> (polar plots) + </td> + <td align="left" valign="top"> + images + </td> + </tr> + <tr> + <td align="left" valign="top"> + Agg + </td> + <td align="left" valign="top"> + png, raw + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + Cairo + </td> + <td align="left" valign="top"> + pdf, + png,ps, + svg, + svgz + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + CocoaAgg + </td> + <td align="left" valign="top"> + png, + raw + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + Emf + </td> + <td align="left" valign="top"> + emf + </td> + <td align="left" valign="top"> + ? + </td> + <td align="left" valign="top"> + ? + </td> + <td align="left" valign="top"> + ? + </td> + <td align="left" valign="top"> + ? + </td> + <td align="left" valign="top"> + ? + </td> + </tr> + <tr> + <td align="left" valign="top"> + FltkAgg + </td> + <td align="left" valign="top"> + png, + raw + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + Gtk + (Gdk) + </td> + <td align="left" valign="top"> + jpeg, + png, + raw + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + GtkAgg + </td> + <td align="left" valign="top"> + jpeg, + png, + raw + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + GtkCairo + </td> + <td align="left" valign="top"> + jpeg, + pdf, + png, + ps, + svg, + svgz + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + Pdf + </td> + <td align="left" valign="top"> + pdf + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + Ps + </td> + <td align="left" valign="top"> + eps,ps + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + QtAgg + </td> + <td align="left" valign="top"> + png,raw + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + Qt4Agg + </td> + <td align="left" valign="top"> + png,raw + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + Svg + </td> + <td align="left" valign="top"> + svg, + svgz + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + TkAgg + </td> + <td align="left" valign="top"> + png,raw + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> + <tr> + <td align="left" valign="top"> + Wx + </td> + <td align="left" valign="top"> + bmp, + jpeg, + pcx, + png, + raw, + tiff, + xpm + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + <td align="left" valign="top"> + + </td> + </tr> + <tr> + <td align="left" valign="top"> + WxAgg + </td> + <td align="left" valign="top"> + png,raw + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + <td align="left" valign="top"> + X + </td> + </tr> +</table> + +<p> + +In addition to these factors, there are other factors that may +affect your backend selection:<p> + +<ul> + <li><b>Scalability:</b> For print, the ability to scale the image to any + resolution is important. Postscript, Pdf and Svg are good + candidates for this. Which will work best for you depends on the + publication tools you are using. + + <li><b>Speed:</b> When running locally, the Agg-related backends are likely + to be the fastest since most of Agg is renderered in C extension + code, and most of the optimization effort has been dedicated to + it. However, when running X11 remotely, the Gtk and Wx backends + may be faster since they send high-level X commands over the + network rather than pixel data.</li> + + <li><b>Interactivity:</b> All of the GUI backends can be used interactively + from a python shell (see <a href=interactive.html>interactive</a>) but + TkAgg is the hands-down winner here since it can be use from any + python shell whereas the GTK and Wx backends require a GUI specific + shell.</li> + + <li><b>Pretty widgets:</b> If you want to embed matplotlib in an application and + pretty GUIs are important to you, Wx, GTK, GTKAgg or GTKCairo are probably + your best best. Tk and Fltk widgets are not visually stunning. </li> +</ul> + +<h3>Choosing a backend</h3> + +You can choose your default backend in +the <a href=matplotlibrc>matplotlibrc</a> file, using the 'backend' +option. The default can be overridden from the command line prompt. +This allows most if not all matplotlib scripts to generate output to +any of the backends without any alterations. Following the lead of +the matlab <tt>print</tt> command, the backend can be chosen from the +command line with the <tt>-d</tt> flag, as in <pre> @@ -59,10 +509,11 @@ matplotlib.use('PS') </pre> -The current backend strings that are supported are +The current backend strings that are supported are <a href=matplotlib.backends.backend_agg.html>Agg</a>, <a href=matplotlib.backends.backend_cairo.html>Cairo</a>, <a +href=matplotlib.backends.backend_fltkagg.html>FltkAgg</a>, <a href=matplotlib.backends.backend_gtk.html>GTK</a>, <a href=matplotlib.backends.backend_gtkagg.html>GTKAgg</a>, <a href=matplotlib.backends.backend_gtkcairo.html>GTKCairo</a>, <a @@ -90,15 +541,17 @@ Specific information for installing the other backends can be found on this page below or by clicking <ul> -<li><a href=backends.html#Agg>Agg</a></li> -<li><a href=backends.html#Cairo>Cairo</a></li> -<li><a href=backends.html#TkAgg>TkAgg</a></li> -<li><a href=backends.html#GTK>GTK</a></li> -<li><a href=backends.html#GTKAgg>GTKAgg</a></li> -<li><a href=backends.html#GTKCairo>GTKCairo</a></li> -<li><a href=backends.html#WX>WX</a></li> -<li><a href=backends.html#WXAgg>WXAgg</a></li> -<li><a href=backends.html#PS>PS</a></li> +<li><a href=#Agg>Agg</a></li> +<li><a href=#Cairo>Cairo</a></li> +<li><a href=#TkAgg>TkAgg</a></li> +<li><a href=#GTK>GTK</a></li> +<li><a href=#GTKAgg>GTKAgg</a></li> +<li><a href=#GTKCairo>GTKCairo</a></li> +<li><a href=#WX>WX</a></li> +<li><a href=#WXAgg>WXAgg</a></li> +<li><a href=#PS>PS</a></li> +<li><a href=#PDF>PDF</a></li> +<li><a href=#SVG>SVG</a></li> </ul> @@ -112,20 +565,19 @@ scripts. Agg can also be embedded in GUI applications, as in the GTKAgg and TkAgg backends -- see <tt>setup.py</tt><p> -The windows installer comes with Agg prebuilt. For other platforms, -to compile Agg from src, set the <tt>BUILD_AGG</tt> flag in -<tt>setup.py</tt>. +matplotlib includes its own copy of Agg. It does not need to be +installed separately, even if compiling matplotlib from source. <a name=Cairo><h3>Cairo</h3></a> -<a href=http://cairographics.org>Cairo</a> is a vector graphics -library designed to provide high-quality display and print output. +<a href=http://cairographics.org>Cairo</a> is a vector graphics +library designed to provide high-quality display and print output. It doesn't depend on a GUI framework and is suitable for use in web application servers generating images for html inclusion or for generating images in batch scripts. Cairo can also be embedded in GUI applications, as in the GTKCairo backend<p> -It requires pycairo version 0.5.0 or higher from +It requires pycairo version 0.5.0 or higher from <a href=http://www.freedesktop.org/Cairo/download>Cairo downloads</a> @@ -133,35 +585,23 @@ This was the first backend supported by matplotlib; it requires -<ul> +<ul> <li><a href=http://numpy.scipy.org/>numpy</a></li> <li><a href=http://prdownloads.sourceforge.net/gtk-win> -GTK runtime</a></li> +GTK runtime</a></li> <li><a href=http://www.pygtk.org>pygtk</a> version 2.0.0 or later</li> </ul> -<h4>Redhat Users</h4> - - GTK2 became the default with the Redhat Linux 8 series. If your - distro is older than that, you'll need to upgrade your desktop, - upgrade your gtk libs, or upgrade your distro.<p> - - I am not sure what the status of GTK2 versus version number is with - the other distros, but I would be happy for answers, so if you know, - please email me @myemail@. If you put matplotlib in the subject, - the email will be sure to get past my spam filters.<p> - - <h2> Windows GTK Quickstart</h2> These install instructions will provide the <a href=backends.html#GTK>GTK<a/> and <a -href=backends.html#GTKAgg>GTK<a/>GTKAgg</a> backends on windows. If +href=backends.html#GTKAgg>GTKAgg<a/> backends on windows. If you encounter troubles, please see <a href=http://matplotlib.sourceforge.net/faq.html#GTKPATH>the FAQ</a><ul> @@ -184,7 +624,7 @@ <li> Install matplotlib using the windows installer on the <a ref=http://sourceforge.net/projects/matplotlib>download page<a></li> -</ul> +</ul> <a name=WX><h3>WX</h3></a> @@ -212,7 +652,7 @@ limitation, GTKAgg marries the widgets of GTK with the rendering of <a href=http:///antigrain.com>antigrain</a>. You need the <a href=backends.html#Agg>agg</a> and <a href=backends.html#GTK>gtk</a> -prerequisites. On windows, GTKAgg is builtin, so you only need to +prerequisites. Agg is builtin, so you only need to install pygtk and the GTK runtime, as described in <a href=backends.html#GTK>gtk</a>. @@ -270,7 +710,7 @@ <a name=PS><h3>Postscript</h3></a> -The only requirement is <a href=http://numpy.scipy.org/>numpy</a><p> +The only requirement is <a href=http://numpy.scipy.org/>numpy</a>.<p> See the <a href=fonts.html#PSFONTS>fonts page</a> for more information about getting the postscript backend setup for proper font rendering; @@ -278,9 +718,15 @@ <tt>AFMPATH</tt> if you want to use fonts other than the ones that ship with matplotlib. +<a name=PS><h3>PDF</h3></a> +The only requirement is <a href=http://numpy.scipy.org/>numpy</a>.<p> +<a name=PS><h3>SVG</h3></a> +The only requirement is <a href=http://numpy.scipy.org/>numpy</a>.<p> + + @footer@ Modified: trunk/htdocs/faq.html.template =================================================================== --- trunk/htdocs/faq.html.template 2007年11月30日 17:39:05 UTC (rev 4529) +++ trunk/htdocs/faq.html.template 2007年11月30日 19:31:05 UTC (rev 4530) @@ -2,7 +2,7 @@ FAQs = ( - ('BUGREPORT', + ('BUGREPORT', 'How do I report a problem?', """\ OK, this is not a FAQ, but I wish it were <wink>.<p> @@ -13,7 +13,7 @@ <pre> > rm -rf build - > python setup.py build + > python setup.py build </pre> @@ -110,7 +110,7 @@ ('CLICKMAPS', "Can I use matplotlib to make clickable images?" , - """\ + """ Yes. Andrew Dalke of <a href=http://www.dalkescientific.com>Dalke Scientific</a> has written a nice <a href=http://www.dalkescientific.com/writings/diary/archive/2005/04/24/interactive_html.html>article</a> @@ -188,7 +188,7 @@ approach taken in <a href=examples/log_bar.py>log_bar.py</a>. """), - ('EQUAL', + ('EQUAL', 'How do I make my figure square / axes sides equal?', """\ There are three considerations: the width/height of the figure, of the @@ -210,7 +210,7 @@ vertical resolutions, you can do a little hack on the figure width and height to correct for the display differences. """), - + ('FREEZE', 'My matplotlib window is freezing', @@ -270,7 +270,7 @@ The swiss army knife of image tools, ImageMagick's <a href=http://imagemagick.sourceforge.net/www/convert.html>convert</a>, -works for this as well.<p> +works for this as well.<p> Here is a simple example script that saves some PNGs, makes them into a movie, and then cleans up. @@ -299,10 +299,10 @@ </pre> """), - + ('FONTMISSING', "When I start matplotlib, I am getting warnings about not being able to find fonts?", """ -matplotlib uses a cache file to store information about your system fonts, and occasionally we reorganize our direcotroy schemes or your system may have changed. When you get warnings about missing fonts, try removing your font cache directory "ttffont.cache" which is located in your ".matplotlib" configuration directory. Where this is depends on your operating system but see the prolog of <a href=matplotlibrc>matplotlibrc</a> for information on where this is stored. You can also run a test pylab script with <tt>--verbose-helpful</tt> or <tt>--verbose-debug</tt>, eg +matplotlib uses a cache file to store information about your system fonts, and occasionally we reorganize our directory schemes or your system may have changed. When you get warnings about missing fonts, try removing your font cache directory "fontManager.cache" which is located in your ".matplotlib" configuration directory. Where this is depends on your operating system but see the prolog of <a href=matplotlibrc>matplotlibrc</a> for information on where this is stored. You can also run a test pylab script with <tt>--verbose-helpful</tt> or <tt>--verbose-debug</tt>, eg <pre> > python test.py --verbose-helpful @@ -326,14 +326,14 @@ install. You may want to try rebuilding with <pre> > rm -rf build - > python setup.py build > build.out + > python setup.py build > build.out </pre> and post the results to the matplotlib-devel or matplotlib-users <a href=http://sourceforge.net/mail/?group_id=80706>mailing lists</a>. """), - + ('EXAMPLES', 'Where can I find information about what matplotlib can do?', """\ @@ -366,39 +366,22 @@ ('LARGEPS', "My PS/EPS files are huge; what's wrong?", """ -With matplotlib-0.61, Paul Barrett introduced truetype fonts in -backend_ps, primarily in order to support mathtext. Because he was -unable to get the individual glyphs from freetype, he had to dump the -entire font into the PS file. A typical font takes about 300K of -noncompressed space. This, however, is a fixed cost and does not -increase with the complexity of the figure or number of points -plotted. It would, however, increase if you use multiple fonts, eg in -mathtext.<p> +As of matplotlib-0.91.0, only the glyphs that are needed for the plot +are saved in the Postscript file. This significantly reduces file +sizes. To revert to the old behavior, where entire font files are +saved in the Postscript file, you can set the parameter 'ps.fonttype' +to 42. -Before 0.61, we used the afm fonts that ship with matplotlib and -matplotlib has its own <a href=matplotlib.afm.html>AFM parser</a> -which handles character metrics, kerning, etc. It would not be too -much work to have an option (eg in the matplotlib rc file) which -allows users to simply use AFM fonts when possible (eg when not using -mathtext) in which case you wouldn't see these big eps files. The -other advantage to this approach is that they seem to render nicer in -some viewers, eg xdvi.<p> - -One nice thing about dumping the truetype into the ps files is that -the text is the same across backends. The ideal solution would be -able to dump just the glyphs needed, which presumably would be much -smaller, but we haven't figured this out yet.<p> - -Given that the 300K is a fixed cost (118K gzipped), if you still find -the size sufficiently troublesome that it justifies the extra work (on -our end) to provide an option to revert to AFM fonts, please let us -know on the mailing list. +Starting with matplotlib-0.87, it is also possible to reduce +Postscript file sizes by using the standard Postscript fonts, rather +than embedding Truetype files. Just set the parameter 'ps.useafm' to +True. """), ('PROMPT', "After my matplotlib script runs, I get a python shell prompt. What's going on?", """ -Tkinter, used by the default windows backend TkAgg not have a mainloop +Tkinter, used by the default windows backend TkAgg does not have a mainloop like GTK or WX. We needed a way to keep the figure open, and decided the best way was to switch into interactive mode in python. This has the additional benefit that you can issue additional python commands @@ -453,7 +436,7 @@ Also, if you are running a python script, make sure your interactive setting in your <a href=matplotlibrc>matplotlibrc</a> is <tt>False</tt>; otherwise the figure will be redrawn with every plotting command when -what you want if for the figure to be drawn only once at the end of +what you want is for the figure to be drawn only once at the end of the script. See <a href=interactive.html>interactive</a> and <a href=faq.html#SHOW>what's up with show?</a> for more information.<p> @@ -473,16 +456,16 @@ output of <tt>python yourscript.py --verbose-helpful</tt>. """), - ('MATPLOTLIBRC', - 'How do I customize the default behavior of matplotib?', + ('MATPLOTLIBRC', + 'How do I customize the default behavior of matplotib?', """ Recent versions of matplotlib (0.51 or later) use a configuration file to set everything from the default font, to the figure size, to the default line width. See <a href=matplotlibrc>matplotlibrc</a> for a sample config file and information on how to use it. """), - ('OO', - 'Is there any guide to using matplotlib with pythonic / OO /API rather than the pylab interface?', + ('OO', + 'Is there any guide to using matplotlib with pythonic / OO /API rather than the pylab interface?', """ @@ -500,10 +483,10 @@ <li>Many examples in the <a href=examples>examples</a> directory in the matplotlib src distribution illustrate the use of the API. - Eg, + Eg, <pre> - + > grep -l FigureCanvas *.py agg_oo.py dynamic_demo_wx.py dynamic_image_wxagg.py @@ -604,7 +587,7 @@ command. See <a examples/customize_rc.py>customize_rc.py</a> for example usage."""), - + ('GTKPATH', 'I cannot import gtk / gdk / gobject', """ @@ -612,7 +595,7 @@ Basically, there are 3 things that I've seen cause failure (relative likelihood in parentheses): - <ul> + <ul> <li> You didn't set the path properly (95% of the time). <it>Solution:</it> Add the lib and bin subdirs of your GTK install @@ -635,62 +618,14 @@ thread</a>, which is filled with good troubleshooting advice. """ ), - + ('WHICHBACKEND', 'Which backend should I use?', """ -Each of the backends offers different strengths. I'll summarize some -of them. - -<h4>Image generation</h4> - -For pure image generation (no GUI) you can choose from the Agg, Cairo, -PS, SVG, Paint, GD or EMF backends. At this point, I advise people to -use the <a href=http://antigrain.com>agg</a> backend because: - -<ul> - <li>it's the fastest</li> - <li>it uses freetype2 (as does GD) which renders nicely even - at small resolutions </li> - <li>there are clipping issues with GD and Paint </li> - <li>it supports fast antialiased drawing and alpha blending </li> - <li>it supports <a href=matplotlib.mathtext.html>mathtext</a></li> - <li>it supports images with <a href=matplotlib.pyplot.html#-imshow>imshow</a></li> -</ul> - -It is likely that with time many of these limitiations or problems -will be fixed on the other backends.<p> - -For publication submission or use with TeX, however, the postscript -backend is naturally a good choice. - -<h4>GUI</h4> - -Currently there are several choices for GUIs: GTK, GTKAgg, GTKCairo, WX, -WXAgg, TkAgg and FltkAgg, with different advantages. - -<ul> - -<li>Speed: TkAgg and GTKAgg are likely to be the fastest since most of Agg is renderered in C extension code</li> - -<li>Stability: GTK was the first backend and thus has been most thoroughly -vetted for bugs. The GTKAgg and GTKCairo backends reuse the GTK widget code, -so should likewise be quite stable</li> - -<li>Interactivity: All of the GUI backends can be used interactively -from a python shell (see <a href=interactive.html>interactive</a>) but -TkAgg is the hands-down winner here since it can be use from any -python shell whereas the GTK and Wx backends require a GUI specific -shell </li> - -<li>Pretty widgets: If you want to embed matplotlib in an application and -pretty GUIs are important to you, Wx, GTK, GTKAgg or GTKCairo are probably -your best best. Tk widgets are not visually stunning. </li> - -</ul> - - +Each of the backends offers different strengths. See the + <a href="backends.html#comparison">comparison of backends for a + discussion of the issues.</p> """), ('DATES', @@ -711,19 +646,19 @@ 'Can I include math expressions in my figures?', r"""As of matplotlib-0.51, you can use TeX markup in any text element. Just use raw strings and enclose the strings with dollar signs, as in -<tt>title(r'$\\alpha > \\beta_i$')</tt>. See <a +<tt>title(r'$\alpha > \beta_i$')</tt>. See <a href=screenshots.html#mathtext_demo>screenshot</a> and the <a href=matplotlib.mathtext.html>mathtext</a> documentation for usage, requirements and backend information. """), - + ('BATCHMODE', 'Can I just generate images without having a window popup?', """ The easiest way to do this is use an image backend, either <a -href=backends.html#Agg>Agg</a>, href=backends.html#Cairo>Cairo</a>, <a -href=backends.html#GD>GD</a> or <a href=backends.html#Paint>Paint</a> -if you want to generate PNG images, eg, for use in a web page, or PS +href=backends.html#Agg>Agg</a>, or <a href=backends.html#Cairo>Cairo</a>, +if you want to generate PNG images, e.g., for use in a web page, or + PS, PDF or SVG if you want publication quality, scalable images. All of these backends run on all of the major platforms. One additional option on an X windows platform is to run the GTK backend under an Xvfb, which @@ -738,10 +673,7 @@ Yes. matplotlb can be used with any web application server that can call python. It has been used with mod_python, xml_rpc, and other frameworks. You'll want to use one of the image backends; <a -href=faq.html#BATCHMODE>see image backends</a>. Also to make small -images appropriate for use on a web page, you may want to consider the -Agg, Cairo or GD backends, since they render small font rasters using -freetype2 better than Paint, which currently use freetype1. You can +href=faq.html#BATCHMODE>see image backends</a>. You can work around the problem of small raster sizes by making your fonts appear larger for a given by decreasing the figure size and increasing the dpi. See <a href=fonts.html#TTFFONTS>ttf fonts</a> for more @@ -773,10 +705,10 @@ """ -You do not need this function with the image backends (Agg, Cairo, Paint, GD, -PS) but you do need it with the GUI (GTK, WX, TkAgg, GTKAgg, GTKCairo) backends, -unless you are running matplotlib in <a -href=interactive.html>interactive mode</a>. <p> +You do not need this function with the image backends (Agg, Cairo, PS, +PDF, SVG) but you do need it with the GUI (GTK, WX, TkAgg, GTKAgg, +GTKCairo) backends, unless you are running matplotlib +in <a href=interactive.html>interactive mode</a>. <p> Because it is expensive to draw, I want to avoid redrawing the figure many times in a batch script such as the following<p> @@ -786,7 +718,7 @@ xlabel('time') # and here ? ylabel('volts') # and here ? title('a simple plot') # and here ? - show() + show() </pre> It is possible to force matplotlib to draw after every command, which @@ -800,21 +732,23 @@ script with <tt>python -i myscript.py -dTkAgg</tt> and then change it interactively from the shell. -<b>IMPORTANT: show should called at most once per script and it should +<b>IMPORTANT: show should be called at most once per script and it should be the last line of your script. At that point, the GUI takes control of the interpreter. If you want to force a figure draw, use <a href=matplotlib.pyplot.html#-draw>draw</a> instead.</b> """), - + ('PSGUI', - 'Can I save PS/EPS from a GUI backend?', + 'Can I save PS/EPS/PDF/SVG etc. from a GUI backend?', """ -Yep. Just choose a filename that contains <tt>ps</tt> in the extension, eg -<tt>somefile.ps</tt> or <tt>somefile.eps</tt> and matplotlib will try -and do the right thing. That is, if it's an eps file, it will include -a bounding box, if it's a ps file it will output plain postscript. It -is recommended you use matplotlib-0.50 or later for this feature to -work properly."""), +Yep. Just choose a filename that contains the desired extension and +matplotlib will try and do the right thing. That is, if it's an eps +file, it will include a bounding box, if it's a ps file it will output +plain postscript. It is recommended you use matplotlib-0.91 or later +for this feature to work properly, since far fewer options are +available for all GUI backends prior to that. +"""), + ('TEXTOVERLAP', 'My title or ticklabel or whatever is overlapping some other figure element, what should I do?', """ @@ -842,7 +776,7 @@ ('DYNAMIC', - 'Can matplotlib do dynamic plots, like digital oscilloscopes or animations?', + 'Can matplotlib do dynamic plots, like digital oscilloscopes or animations?', """ Absolutely. See for example, <a href=examples/anim.py>anim.py</a> and <a href=examples/system_monitor.py>system_monitor.py</a>"""), @@ -862,10 +796,10 @@ ('IMAGES', 'Can matplotlib handle image data?', """ -Yes - you can now plot images from numerix arraysq with <a +Yes - you can now plot images from numpy arrays with <a href=matplotlib.pyplot.html#-imshow>imshow</a>. You can load png files into arrays <a href=matplotlib.pyplot.html#-imread>imread</a>; -image loaders coming soon."""), +other image loaders coming soon."""), ('ROTATETICKS', 'How do I make vertical xticklabels?', @@ -876,7 +810,7 @@ from pylab import * plot([1,2,3,4], [1,4,9,16]) set(gca(), 'xticks', [1,2,3,4]) - labels = set(gca(), 'xticklabels', + labels = set(gca(), 'xticklabels', ['Frogs', 'Hogs', 'Bogs', 'Slogs']) set(labels, 'rotation', 'vertical') show() @@ -892,7 +826,7 @@ C:\GTK\etc\pango\pango.aliases. Add a line like <pre> -times = "times new roman,angsana new,mingliu,simsun,\\ +times = "times new roman,angsana new,mingliu,simsun,\\ gulimche,ms gothic,latha,mangal,code2000" </pre> @@ -904,7 +838,7 @@ experiencing for ages with matplotlib. I was getting WARNING **: Couldn't load font "MS Sans Serif 8" falling back to "Sans 8" - errors. + errors. It's addressed in their FAQ, http://www2.arnes.si/~sopjsimo/gimp/faq.html>, reproduced here: @@ -924,20 +858,20 @@ I took option B and now all is well with both Gimp and Matplotlib. I'm running Win98 and the Gimp FAQ entry hints that it may be a -problem in Win98,ME and NT installations. +problem in Win98,ME and NT installations. </pre> -""" +""" ), - + ('FREETYPE2', "Why are my fonts not being rendered properly?", """ -This is probably due to an outdated freetype2 library. The latest -version is 2.1.9. See <a href=matplotlib.font_manager.html>font manager +This is probably due to an outdated freetype2 library. +See <a href=matplotlib.font_manager.html>font manager docs</a> for details. """ ), @@ -945,17 +879,15 @@ """My SVG viewer doesn't properly display special (TeX) characters ('\sum', '\infty',etc.) generated by mathtext. Is this a bug?""", """ -You need to install the BaKoMa fonts (TrueType version of the Computer +As of matplotlib-0.91.0, the glyph outlines for the font are embedded +directly in the SVG file, so this should not occur. + +For matplotlib-0.90.0 and earlier, +you need to install the BaKoMa fonts (TrueType version of the Computer Modern fonts) on your system. The BaKoMa fonts come packaged with matplotlib. They are located in the "site-packages/matplotlib/mpl-data/fonts/ttf" dir (the cm*.ttf files). Installation of the fonts varies from OS to OS. - -Alternatively, as of r3498 (matplotlib > 0.90.1) you can set -svg.embed_char_paths to True in your matplotlibrc file. This -setting makes matplotlib embed all fonts as paths in the SVG file, -which results in a "portable" SVG file, at the cost of bigger file -size and uneditable text. """ ), ('LEAKS', @@ -970,14 +902,13 @@ the <tt>--without-pymalloc</tt> flag, which disables pool allocation.) If after sufficient iterations, you still see that memory usage is increasing, it is a likely a bonafide memory leak that should be -reported. +reported.<p> -</a> The unit directory of the source tree contains an example scripts useful for diagnosing and reporting memory leaks. For -example, <a href="http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/unit/memleak_hawaii.py?view=markup"><tt>memleak_hawaii.py</tt> +example, <a href="http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/unit/memleak_hawaii.py?view=markup"><tt>memleak_hawaii.py</tt></a> is useful for finding plotting-related memory leaks, - and <a href="http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/unit/memleak_gui.py?view=markup"><tt>memleak_gui.py</tt> + and <a href="http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/unit/memleak_gui.py?view=markup"><tt>memleak_gui.py</tt></a> helps find memory leaks in the GUI-backend. Please use something like these when reporting leaks so we get an idea of the magnitude of the problem (i.e. bytes per figure). Also please provide @@ -987,12 +918,12 @@ obvious coding errors vis-a-vis matplotlib.<p> There are some known memory leaks in matplotlib-0.90.1 when used in -conjunction with the Tk, Gtk, Wx, Qt and Qt4 GUI backends. Many of -these leaks have resolutions in the current SVN version of matplotlib. +conjunction with the Tk, Gtk, Wx, Qt and Qt4 GUI backends. Many of +these leaks have resolutions in the current SVN version of matplotlib. However, the following library versions are known to have leaks that matplotlib triggers. If you have one of these versions and are experiencing memory leaks, you should upgrade your library. This is -not an exhaustive list. +not an exhaustive list.<p> <ul> <li><b>Wx backend:</b>wxPython-2.8.2 or earlier in the 2.8 series @@ -1028,7 +959,7 @@ This will print out all of the reference cycles that are preventing the uncollectable objects from being freed. The code should then be modified to prevent these cycles, or break the cycles during - destruction. + destruction.<p> <li><b>Real references:</b> Sometimes objects are legitimately being held onto by other Python objects. When this happens, you would @@ -1045,7 +976,7 @@ <pre> original_objects = [id(x) for x in gc.get_objects()] # ... do something that leaks objects - new_objects = [x for x in gc.get_objects() + new_objects = [x for x in gc.get_objects() if id(x) not in original_objects] </pre> You can then determine what is referencing those objects and @@ -1053,7 +984,7 @@ <pre> print gc.get_referents(x) </pre> - The code should be modified to prevent these unwanted references. + The code should be modified to prevent these unwanted references.<p> <li><b>C/C++ leaks in extension objects:</b> These is the classic problem of objects that are "malloc'd/new'd" and never @@ -1104,9 +1035,9 @@ href=http://matplotlib.sf.net/examples>examples</a> explaining how to embed matplotlib in your GUI of choice. """), - + ) - + @header@ <h2> matplotlib FAQ </h2> Modified: trunk/htdocs/fonts.html.template =================================================================== --- trunk/htdocs/fonts.html.template 2007年11月30日 17:39:05 UTC (rev 4529) +++ trunk/htdocs/fonts.html.template 2007年11月30日 19:31:05 UTC (rev 4530) @@ -1,39 +1,29 @@ -@header@ -<h2>Font handling</h2> +@header@ +<h2>Font handling</h2> I have spent a lot of time trying to make text in matplotlib look good. This has been a limitation of many pre-exisiting python graphing solutions, but with the rise of freetype and anti-aliased rendering for linux, it is now possible to have great looking fonts. -<h3><a name=TTFFONTS>Freetype fonts: GD, Agg, Paint</a></h3> +<h3><a name=TTFFONTS>Truetype fonts</a></h3> -The GD, Agg, and Paint backends all support freetype fonts, which +All of the backends support Truetype fonts, which provide high quality, anti-aliased font rendering to PNG and JPEG output -without X support. This is particularly useful for batch processing +with or without X support. This is particularly useful for batch processing over terminal, or for web application servers. <p> You need to have truetype '*.ttf' files on your system to use these fonts. The font finder does platform dependent searches to find them. -In addition, matplotlib distributes the <tt>Vera</tt> fonts from -bitstream, which were released under a permissive license, as well as -the BaKoMa computer modern TeX fonts, which are free for noncommerical -use. If you want more, set the environment variable <tt>TTFPATH</tt> to -point to them. Note, if you are on linux but have access to a licensed -copy of windows ttf fonts, the same <tt>*.ttf</tt> fonts in -<tt>C:\windows\fonts</tt> will work with matplotlib on linux if you -place them in your TTFPATH; see <a href=http://corefonts.sf.net>core -fonts</a>.<p> +In addition, matplotlib distributes +the <a href="http://www.gnome.org/fonts">Vera</a> fonts from +Bitstream, the BaKoMa Computer Modern TeX fonts, and +the <a href="http://www.stixfonts.org/">STIX</a> math fonts, all of +which are available under different permissive licenses. If you want +more, most of the time, matplotlib will pick up fonts installed in the +standard place(s) on your operating system. Note that on Linux, you +may need to run 'fc-cache' after installing new fonts.<p> -If you are using matplotlib to generate images for html, you may want to -consider using a backend which supports freetype2. freetype 2 tends to -render fonts better at very small raster sizes. See <a -href=faq.html#APPSERVER>matplotlib images in html</a> and <a -href=matplotlib.font_manager.html>font manager docs</a> for more -information. The Agg and GD image backends both support freetype2. If -you are trying to decide among an image backend, see the <a -href=faq.html#WHICHBACKEND>which backend should I use</a><p> - If you are aware of other freely distributable ttf fonts, please contact me. @@ -45,6 +35,14 @@ describing fonts. Formerly, matplotlib required the external packages fonttools and ttfquery, but no longer does.<p> +As of matplotlib-0.91.0, fonts can also be specified using the +fontconfig pattern syntax +described <a href="http://fontconfig.org/fontconfig-user.html">here</a>. +A fontconfig pattern string may be used in place of a FontProperties +class instance.<p> + +<h4>Font properties</h4> + Fonts are described by properties, and the font manager searches your system for the font that most closely matches the properties you choose. The 6 font properties used for font matching are given below with their @@ -56,7 +54,7 @@ for an example setting the default font property and changing it in the middle of the script. -<h4>font family</h4> +<h5>font family</h5> The font.family property has five values: 'serif' (e.g. Times), 'sans-serif' (e.g. Helvetica), 'cursive' (e.g. Zapf-Chancery), 'fantasy' @@ -72,58 +70,35 @@ font manager will try and find the best font no matter which platform you run on. -<h4>font style</h4> +<h5>font style</h5> The font.style property has three values: normal (or roman), italic or oblique. The oblique style will be used for italic, if it is not present. -<h4>font variant</h4> +<h5>font variant</h5> The font.variant property has two values: normal or small-caps. For TrueType fonts, which are scalable fonts, small-caps is equivalent to using a font size of 'smaller', or about 83% of the current font size. -<h4>font weight</h4> +<h5>font weight</h5> The font.weight property has effectively 13 values: normal, bold, bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as 400, and bold is 700. bolder and lighter are relative values with respect to the current weight. -<h4>font stretch</h4> +<h5>font stretch</h5> The font.stretch property has 11 values: ultra-condensed, extra-condensed, condensed, semi-condensed, normal, semi-expanded, expanded, extra-expanded, ultra-expanded, wider, and narrower. This property is not currently implemented. -<h4>font size</h4> +<h5>font size</h5> The font.size property has 11 values: xx-small, x-small, small, medium, large, x-large, xx-large, larger, smaller, length (such as 12pt), and percentage. larger and smaller are relative values. percentage is not yet implemented. - - -<h3><a name=GTKFONTS>GTK</a></h3> - -The most recent versions of GTK (2.2.4.1 and later) and pygtk-2.0.0 -and later on linux have freetype font support built-in by default. If -you are using an older version, set the environment variable -<tt>GDK_USE_XFT</tt> - -<pre> -export GDK_USE_XFT=1 # bash and friends -</pre> - -or - -<pre> -setenv GDK_USE_XFT 1 # csh and friends -</pre> - -If you are using GTK under windows, see <a -href=http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq21.011.htp>the -pygtk FAQ</a>. - <h3><a name=PSFONTS>Postscript</a></h3> <a Modified: trunk/htdocs/tutorial.html.template =================================================================== --- trunk/htdocs/tutorial.html.template 2007年11月30日 17:39:05 UTC (rev 4529) +++ trunk/htdocs/tutorial.html.template 2007年11月30日 19:31:05 UTC (rev 4530) @@ -27,11 +27,11 @@ ) - -@header@ -<h2>Using matplotlib</h2> +@header@ +<h2>Using matplotlib</h2> + If you are new to python, I recommend reading the <a href=http://docs.python.org/tut/tut.html>python tutorial</a> and <a @@ -190,7 +190,7 @@ There are several ways to set line properties <pre> # Use keyword args -plot(x, y, linewidth=2.0) +plot(x, y, linewidth=2.0) # Use the setter methods of the Line2D instance. plot returns a list # of lines; eg line1, line2 = plot(x1,y1,x2,x2). Below I have only @@ -202,7 +202,7 @@ # Use the set command. The example below uses matlab handle graphics # style command to set multiple properties on a list of lines. Set # works transparently with a list of objects or a single object -lines = plot(x1, y1, x2, y2) +lines = plot(x1, y1, x2, y2) setp(lines, color='r', linewidth=2.0) @@ -301,8 +301,8 @@ from pylab import * figure(1) # the first figure -plot([1,2,3]) -figure(2) # a second figure +plot([1,2,3]) +figure(2) # a second figure plot([4,5,6]) figure(1) # figure 1 current @@ -311,7 +311,7 @@ </pre> You can clear the current figure with <a -href=matplotlib.pyplot.html#-clf>clf</a> and the current axes with +href=matplotlib.pyplot.html#-clf>clf</a> and the current axes with <a href=matplotlib.pyplot.html#-cla>cla</a> @@ -448,8 +448,13 @@ Any text element can use math text. You need to use raw strings (preceed the quotes with an <tt>'r'</tt>), and surround the string -text with dollar signs, as in TeX. +text with dollar signs, as in TeX. Regular text and mathtext can be +interleaved within the same string.<p> +Mathtext can use the Bakoma Computer Modern fonts, STIX fonts or a +Unicode font that you provide. The mathtext font can be selected with +the customization variable "mathtext.fontset".<p> + <pre> # plain text title('alpha > beta') @@ -458,7 +463,7 @@ title(r'$\alpha > \beta$') </pre> -To make subscripts and superscripts use the '_' and '^' symbols, as in +To make subscripts and superscripts use the '_' and '^' symbols, as in <pre> title(r'$\alpha_i > \beta_i$') @@ -475,17 +480,29 @@ </pre> The default font is <i>italics</i> for mathematical symbols. To -change fonts, eg, to write "sin" in a roman font, enclose the text in +change fonts, eg, to write "sin" in a Roman font, enclose the text in a font command, as in <pre> -text(1,2, r's(t) = $\cal{A}\rm{sin}(2 \omega t)$') +text(1,2, r's(t) = $\mathcal{A}\mathrm{sin}(2 \omega t)$') </pre> +Even better, many commonly used function names that are typeset in a +Roman font have shortcuts. So the expression above could be written +as follows: + +<pre> +text(1,2, r's(t) = $\mathcal{A}\sin(2 \omega t)$') +</pre> + Here "s" and "t" are variable in italics font (default), "sin" is in -roman font, and the amplitude "A" is in caligraphy font. The font -choices are roman <tt>\rm</tt>, italics <tt>\it</tt>, caligraphy -<tt>\cal</tt>, and typewriter <tt>\tt</tt> <p> +Roman font, and the amplitude "A" is in caligraphy font. The font +choices are Roman <tt>\mathrm</tt>, italics <tt>\mathit</tt>, caligraphy +<tt>\mathcal</tt>, and typewriter <tt>\mathtt</tt>. If using the STIX +fonts, you also have the choice +of blackboard (double-struck) <tt>\mathbb</tt>, +circled <tt>\mathcircled</tt>, Fraktur <tt>\mathfrak</tt>, script +(cursive) <tt>\mathscr</tt> and sans-serif <tt>\mathsf</tt>.<p> The following accents are provided: <tt>\hat</tt>, <tt>\breve</tt>, <tt>\grave</tt>, <tt>\bar</tt>, <tt>\acute</tt>, <tt>\tilde</tt>, @@ -506,7 +523,7 @@ plot(t,s) title(r'$\alpha_i > \beta_i$', fontsize=20) text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20) -text(0.6, 0.6, r'$\cal{A}\rm{sin}(2 \omega t)$', +text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$', fontsize=20) xlabel('time (s)') ylabel('volts (mV)') @@ -526,7 +543,7 @@ to navigate through the data set. You can select either the "classic" or newfangled toolbar "toolbar2" in your <a href=matplotlibrc>matplotlibrc</a> file using the <tt>toolbar</tt> -setting. +setting. If you want to interact with very large data sets, matplotlib supports data clipping where the data is clipped with numerix before they are @@ -553,7 +570,7 @@ so you never have to move the mouse to pan the x-axis left and right. If you don't have a wheel mouse, buy one!<p> -<table> +<table> <tr><td><img src=tut/navcontrols.png></td></tr> <tr><td width=400> <i>The left widget that says 'All' on the controls on the bottom of the figure is a drop down menu used to select which axes the @@ -586,7 +603,7 @@ <b>The Pan/Zoom</b> button has two modes: pan and zoom. Click this toolbar button to activate this mode. Then put your mouse somewhere over an -axes. +axes. <ul> <li>Pan Mode: Press the left mouse button and hold it, dragging it to @@ -594,7 +611,7 @@ you pressed will be moved to the point where you released. If you press 'x' or 'y' while panning, the motion will be contrained to the x or y axis, respectively</li> - + <li>Zoom Mode: Press the right mouse button, dragging it to a new position. The x axis will be zoomed in proportionate to the rightward movement and zoomed out proportionate to the leftward @@ -626,7 +643,7 @@ PNG over JPG and TIFF, which is why I haven't worked too hard to include these other image formats in agg.<p> -<table> +<table> <tr><td><img src=tut/navcontrols2.png></td></tr> <tr><td width=400> <i>The new toolbar2</i> </td></tr> </table><br> @@ -687,13 +704,13 @@ plot([1,2,3]) glines = getp(gca(), 'gridlines') # make the gridlines blue and thicker -setp(glines, 'color', 'b', 'linewidth', 2) +setp(glines, 'color', 'b', 'linewidth', 2) -# get the patches.Rectangle instance increase +# get the patches.Rectangle instance increase # the linewidth of the rectangular axis frame -frame = gca(gca(), 'frame') -setp(frame, 'linewidth', 2) - +frame = gca(gca(), 'frame') +setp(frame, 'linewidth', 2) + </pre> @@ -770,7 +787,7 @@ print 'you clicked', event.x, event.y #register this function with the event handler -connect('button_press_event', click) +connect('button_press_event', click) </pre> Then whenever the user clicks anywhere on the figure canvas, your @@ -791,7 +808,7 @@ <tr><td>canvas</td><td>The FigureCanvas instance the event occured in</td></tr> <tr><td>key</td><td>The key press if any, eg 'a', 'b', '1'. Also records 'control and 'shift'</td></tr> -</table> +</table> You can connect to the following events: 'button_press_event', 'button_release_event', 'motion_notify_event'. @@ -868,7 +885,7 @@ <pre> # make up some random y values -s = rand(len(dates)) +s = rand(len(dates)) plot_date(dates, s) </pre> @@ -909,10 +926,10 @@ <pre> # every 5 years -years = YearLocator(5) +years = YearLocator(5) # every quarter -months = MonthLocator(range(3,13,3)) +months = MonthLocator(range(3,13,3)) </pre> The date tick locators MinuteLocator, HourLocator, DayLocator, @@ -939,7 +956,7 @@ </td></tr> </table><br> -<h4>timezones with pytz</h4> +<h4>timezones with pytz</h4> Timezone support is provided via the <a href=http://pytz.sourceforge.net/>pytz</a> module. This module This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4529 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4529&view=rev Author: jswhit Date: 2007年11月30日 09:39:05 -0800 (2007年11月30日) Log Message: ----------- make plot smaller so it fits onscreen Modified Paths: -------------- trunk/toolkits/basemap/examples/setwh.py Modified: trunk/toolkits/basemap/examples/setwh.py =================================================================== --- trunk/toolkits/basemap/examples/setwh.py 2007年11月30日 17:32:59 UTC (rev 4528) +++ trunk/toolkits/basemap/examples/setwh.py 2007年11月30日 17:39:05 UTC (rev 4529) @@ -17,7 +17,7 @@ npanel = 0 # plots of the US. projs = ['lcc','aeqd','aea','laea','eqdc','stere'] -fig = figure(figsize=(8,12)) +fig = figure(figsize=(7,7)) for proj in projs: m = Basemap(width=width,height=height, resolution='c',projection=proj,\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4528 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4528&view=rev Author: jswhit Date: 2007年11月30日 09:32:59 -0800 (2007年11月30日) Log Message: ----------- color ocean areas Modified Paths: -------------- trunk/toolkits/basemap/examples/garp.py trunk/toolkits/basemap/examples/geos_demo.py Modified: trunk/toolkits/basemap/examples/garp.py =================================================================== --- trunk/toolkits/basemap/examples/garp.py 2007年11月30日 16:16:34 UTC (rev 4527) +++ trunk/toolkits/basemap/examples/garp.py 2007年11月30日 17:32:59 UTC (rev 4528) @@ -32,9 +32,9 @@ # 20 degree graticule. m.drawparallels(arange(-80,81,20)) m.drawmeridians(arange(-180,180,20)) -# draw a red dot at the center. +# draw a black dot at the center. xpt, ypt = m(lon_0, lat_0) -m.plot([xpt],[ypt],'ro') +m.plot([xpt],[ypt],'ko') # draw the title. title('The World According to Garp in '+location) show() Modified: trunk/toolkits/basemap/examples/geos_demo.py =================================================================== --- trunk/toolkits/basemap/examples/geos_demo.py 2007年11月30日 16:16:34 UTC (rev 4527) +++ trunk/toolkits/basemap/examples/geos_demo.py 2007年11月30日 17:32:59 UTC (rev 4528) @@ -24,7 +24,8 @@ fig = figure() m = Basemap(projection='geos',lon_0=lon_0,satellite_height=h,rsphere=(6378137.00,6356752.3142),resolution='l') m.drawcoastlines() -m.fillcontinents(color='coral') +m.drawmapboundary(fill_color='aqua') +m.fillcontinents(color='coral',lake_color='aqua') m.drawcountries() # draw parallels and meridians. m.drawparallels(arange(-90.,120.,30.)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4527 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4527&view=rev Author: mdboom Date: 2007年11月30日 08:16:34 -0800 (2007年11月30日) Log Message: ----------- Fix Cairo alpha-blending. Modified Paths: -------------- branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_cairo.py Modified: branches/transforms/lib/matplotlib/backend_bases.py =================================================================== --- branches/transforms/lib/matplotlib/backend_bases.py 2007年11月30日 16:08:52 UTC (rev 4526) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007年11月30日 16:16:34 UTC (rev 4527) @@ -27,7 +27,7 @@ The following methods *should* be implemented in the backend for optimization reasons: - + draw_markers draw_path_collection draw_quad_mesh @@ -73,7 +73,7 @@ self.draw_path(gc, marker_path, marker_trans + transforms.Affine2D().translate(x, y), rgbFace) - + def draw_path_collection(self, master_transform, cliprect, clippath, clippath_trans, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, @@ -126,12 +126,12 @@ else: edgecolors = facecolors linewidths = npy.array([1.0], npy.float_) - + return self.draw_path_collection( master_transform, cliprect, clippath, clippath_trans, paths, [], offsets, offsetTrans, facecolors, edgecolors, linewidths, [], [antialiased]) - + def _iter_collection_raw_paths(self, master_transform, paths, all_transforms): """ This is a helper method (along with _iter_collection) to make @@ -203,20 +203,20 @@ return if Noffsets: toffsets = offsetTrans.transform(offsets) - + gc = self.new_gc() gc.set_clip_rectangle(cliprect) if clippath is not None: clippath = transforms.TransformedPath(clippath, clippath_trans) gc.set_clip_path(clippath) - + if Nfacecolors == 0: rgbFace = None if Nedgecolors == 0: gc.set_linewidth(0.0) - + xo, yo = 0, 0 for i in xrange(N): path_id = path_ids[i % Npaths] @@ -233,7 +233,7 @@ gc.set_antialiased(antialiaseds[i % Naa]) yield xo, yo, path_id, gc, rgbFace - + def get_image_magnification(self): """ Get the factor by which to magnify images passed to draw_image. @@ -282,7 +282,7 @@ your text. """ raise NotImplementedError - + def flipy(self): """return true if y small numbers are top for renderer Is used for drawing text (text.py) and images (image.py) only @@ -334,8 +334,8 @@ def stop_rasterizing(self): pass - + class GraphicsContextBase: """An abstract base class that provides color, line styles, etc... """ @@ -380,8 +380,6 @@ Return the alpha value used for blending - not supported on all backends """ - if len(self._rgb) == 4: - return self._rgb[3] return self._alpha def get_antialiased(self): @@ -795,7 +793,7 @@ # can't delete the artist while h: print "Removing",h - if h.remove(): + if h.remove(): self.draw_idle() break parent = None @@ -804,7 +802,7 @@ parent = p break h = parent - + def onHilite(self, ev): """ Mouse event processor which highlights the artists @@ -980,7 +978,7 @@ # a) otherwise we'd have cyclical imports, since all of these # classes inherit from FigureCanvasBase # b) so we don't import a bunch of stuff the user may never use - + def print_emf(self, *args, **kwargs): from backends.backend_emf import FigureCanvasEMF # lazy import emf = self.switch_backends(FigureCanvasEMF) @@ -990,7 +988,7 @@ from backends.backend_ps import FigureCanvasPS # lazy import ps = self.switch_backends(FigureCanvasPS) return ps.print_eps(*args, **kwargs) - + def print_pdf(self, *args, **kwargs): from backends.backend_pdf import FigureCanvasPdf # lazy import pdf = self.switch_backends(FigureCanvasPdf) @@ -1000,7 +998,7 @@ from backends.backend_agg import FigureCanvasAgg # lazy import agg = self.switch_backends(FigureCanvasAgg) return agg.print_png(*args, **kwargs) - + def print_ps(self, *args, **kwargs): from backends.backend_ps import FigureCanvasPS # lazy import ps = self.switch_backends(FigureCanvasPS) @@ -1016,12 +1014,12 @@ from backends.backend_svg import FigureCanvasSVG # lazy import svg = self.switch_backends(FigureCanvasSVG) return svg.print_svg(*args, **kwargs) - + def print_svgz(self, *args, **kwargs): from backends.backend_svg import FigureCanvasSVG # lazy import svg = self.switch_backends(FigureCanvasSVG) return svg.print_svgz(*args, **kwargs) - + def get_supported_filetypes(self): return self.filetypes @@ -1031,7 +1029,7 @@ groupings.setdefault(name, []).append(ext) groupings[name].sort() return groupings - + def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w', orientation='portrait', format=None, **kwargs): """ @@ -1069,7 +1067,7 @@ if dpi is None: dpi = rcParams['savefig.dpi'] - + origDPI = self.figure.dpi origfacecolor = self.figure.get_facecolor() origedgecolor = self.figure.get_edgecolor() @@ -1092,12 +1090,12 @@ self.figure.set_edgecolor(origedgecolor) self.figure.set_canvas(self) self.figure.canvas.draw() - + return result def get_default_filetype(self): raise NotImplementedError - + def set_window_title(self, title): """ Set the title text of the window containing the figure. Note that Modified: branches/transforms/lib/matplotlib/backends/backend_cairo.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_cairo.py 2007年11月30日 16:08:52 UTC (rev 4526) +++ branches/transforms/lib/matplotlib/backends/backend_cairo.py 2007年11月30日 16:16:34 UTC (rev 4527) @@ -94,8 +94,8 @@ def set_ctx_from_surface (self, surface): self.ctx = cairo.Context (surface) self.ctx.save() # restore, save - when call new_gc() - + def set_width_height(self, width, height): self.width = width self.height = height @@ -111,12 +111,12 @@ if len(fill_c) == 3: ctx.set_source_rgba (fill_c[0], fill_c[1], fill_c[2], alpha) else: - ctx.set_source_rgba (*fill_c) + ctx.set_source_rgba (fill_c[0], fill_c[1], fill_c[2], alpha*fill_c[3]) ctx.fill_preserve() ctx.restore() ctx.stroke() - + #@staticmethod def convert_path(ctx, tpath): for points, code in tpath.iter_segments(): @@ -134,7 +134,7 @@ ctx.close_path() convert_path = staticmethod(convert_path) - + def draw_path(self, gc, path, transform, rgbFace=None): if len(path.vertices) > 18980: raise ValueError("The Cairo backend can not draw paths longer than 18980 points.") @@ -143,7 +143,7 @@ transform = transform + \ Affine2D().scale(1.0, -1.0).translate(0, self.height) tpath = transform.transform_path(path) - + ctx.new_path() self.convert_path(ctx, tpath) @@ -203,11 +203,11 @@ ctx.translate(x, y) if angle: ctx.rotate (-angle * npy.pi / 180) - + for font, fontsize, s, ox, oy in glyphs: ctx.new_path() ctx.move_to(ox, oy) - + fontProp = ttfFontProperty(font) ctx.save() ctx.select_font_face (fontProp.name, @@ -228,7 +228,7 @@ ctx.restore() - + def flipy(self): if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name()) return True @@ -281,8 +281,8 @@ def points_to_pixels(self, points): if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name()) return points/72.0 * self.dpi - - + + class GraphicsContextCairo(GraphicsContextBase): _joind = { 'bevel' : cairo.LINE_JOIN_BEVEL, @@ -323,6 +323,8 @@ def set_clip_rectangle(self, rectangle): self._cliprect = rectangle + if rectangle is None: + return x,y,w,h = rectangle.bounds # pixel-aligned clip-regions are faster @@ -345,7 +347,7 @@ RendererCairo.convert_path(ctx, tpath) ctx.clip() - + def set_dashes(self, offset, dashes): self._dashes = offset, dashes if dashes == None: @@ -382,7 +384,7 @@ self._linewidth = w self.ctx.set_line_width (self.renderer.points_to_pixels(w)) - + def new_figure_manager(num, *args, **kwargs): # called by backends/__init__.py """ Create a new figure manager instance @@ -406,7 +408,7 @@ self.figure.draw (renderer) surface.write_to_png (fobj) - + def print_pdf(self, fobj, *args, **kwargs): return self._save(fobj, 'pdf', *args, **kwargs) @@ -418,16 +420,16 @@ def print_svgz(self, fobj, *args, **kwargs): return self._save(fobj, 'svgz', *args, **kwargs) - + def get_default_filetype(self): return rcParams['cairo.format'] - + def _save (self, fo, format, **kwargs): # save PDF/PS/SVG orientation = kwargs.get('orientation', 'portrait') dpi = 72 - self.figure.dpi.set (dpi) + self.figure.dpi = dpi w_in, h_in = self.figure.get_size_inches() width_in_points, height_in_points = w_in * dpi, h_in * dpi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4526 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4526&view=rev Author: jswhit Date: 2007年11月30日 08:08:52 -0800 (2007年11月30日) Log Message: ----------- release 0.9.8 Modified Paths: -------------- trunk/toolkits/basemap/Changelog Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2007年11月30日 15:51:18 UTC (rev 4525) +++ trunk/toolkits/basemap/Changelog 2007年11月30日 16:08:52 UTC (rev 4526) @@ -1,4 +1,4 @@ -version 0.9.8 (not yet released) +version 0.9.8 (svn revision 4526) * fixes for filling continents in orthographic projection. * added 'maskandscale' kwarg to NetCDFFile to optionally turn off automatic masking and rescaling This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4525 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4525&view=rev Author: mdboom Date: 2007年11月30日 07:51:18 -0800 (2007年11月30日) Log Message: ----------- Fix shadows (see pie_demo.py) Modified Paths: -------------- branches/transforms/lib/matplotlib/patches.py Modified: branches/transforms/lib/matplotlib/patches.py =================================================================== --- branches/transforms/lib/matplotlib/patches.py 2007年11月30日 15:50:35 UTC (rev 4524) +++ branches/transforms/lib/matplotlib/patches.py 2007年11月30日 15:51:18 UTC (rev 4525) @@ -71,7 +71,7 @@ self._hatch = hatch self._combined_transform = transforms.IdentityTransform() self.fill = fill - + if len(kwargs): artist.setp(self, **kwargs) __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd @@ -105,7 +105,7 @@ def get_extents(self): return self.get_path().get_extents(self.get_transform()) - + def get_transform(self): return self._combined_transform @@ -116,10 +116,10 @@ def get_data_transform(self): return artist.Artist.get_transform(self) - + def get_patch_transform(self): return transforms.IdentityTransform() - + def get_antialiased(self): return self._antialiased @@ -155,7 +155,7 @@ ACCEPTS: any matplotlib color """ self._facecolor = color - + def set_linewidth(self, w): """ Set the patch linewidth in points @@ -212,7 +212,7 @@ if cbook.is_string_like(self._edgecolor) and self._edgecolor.lower()=='none': gc.set_linewidth(0) - else: + else: gc.set_foreground(self._edgecolor) gc.set_linewidth(self._linewidth) @@ -226,7 +226,7 @@ rgbFace = None else: rgbFace = colors.colorConverter.to_rgb(self._facecolor) - + if self._hatch: gc.set_hatch(self._hatch ) @@ -234,7 +234,7 @@ transform = self.get_transform() tpath = transform.transform_path_non_affine(path) affine = transform.get_affine() - + renderer.draw_path(gc, tpath, affine, rgbFace) #renderer.close_group('patch') @@ -322,25 +322,25 @@ def _update_transform(self): self._shadow_transform = transforms.Affine2D().translate(self._ox, self._oy) - + def _get_ox(self): return self._ox def _set_ox(self, ox): self._ox = ox self._update_transform() - + def _get_oy(self): return self._oy def _set_oy(self, oy): self._oy = oy self._update_transform() - + def get_path(self): return self.patch.get_path() def get_patch_transform(self): - return self._shadow_transform - + return self.patch.get_patch_transform() + self._shadow_transform + class Rectangle(Patch): """ Draw a rectangle with lower left at xy=(x,y) with specified @@ -385,7 +385,7 @@ x, y = self.get_transform().inverted().transform_point( (mouseevent.x, mouseevent.y)) return (x >= 0.0 and x <= 1.0 and y >= 0.0 and y <= 1.0), {} - + def get_x(self): "Return the left coord of the rectangle" return self._bbox.x0 @@ -480,9 +480,9 @@ self._path = Path.unit_regular_polygon(numVertices) self._poly_transform = transforms.Affine2D() self._update_transform() - + Patch.__init__(self, **kwargs) - + __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd def _update_transform(self): @@ -504,7 +504,7 @@ self._orientation = xy self._update_transform() orientation = property(_get_orientation, _set_orientation) - + def _get_radius(self): return self._radius def _set_radius(self, xy): @@ -518,13 +518,13 @@ self._numVertices = numVertices self._path = Path.unit_regular_polygon(numVertices) numvertices = property(_get_numvertices, _set_numvertices) - + def get_path(self): return self._path def get_patch_transform(self): return self._poly_transform - + class PathPatch(Patch): """ A general polycurve path patch. @@ -535,7 +535,7 @@ def __init__(self, path, **kwargs): """ path is a Path object - + Valid kwargs are: %(Patch)s See Patch documentation for additional kwargs @@ -574,7 +574,7 @@ def _set_xy(self, vertices): self._path = Path(vertices) xy = property(_get_xy, _set_xy) - + class Wedge(Patch): def __str__(self): return "Wedge(%g,%g)"%self.xy[0] @@ -612,7 +612,7 @@ [ 0.8, -0.1 ], [ 0.8, -0.3], [ 1.0, 0.0 ], [ 0.8, 0.3], [ 0.8, 0.1 ], [ 0.0, 0.1] ] ) - + def __init__( self, x, y, dx, dy, width=1.0, **kwargs ): """Draws an arrow, starting at (x,y), direction and length given by (dx,dy) the width of the arrow is scaled by width @@ -636,7 +636,7 @@ def get_patch_transform(self): return self._patch_transform - + class FancyArrow(Polygon): """Like Arrow, but lets you set head width and head height independently.""" @@ -744,7 +744,7 @@ def get_path(self): # Since this is dpi dependent, we need to recompute the path # every time. - + # the base vertices x1, y1 = self.xytip x2, y2 = self.xybase @@ -767,7 +767,7 @@ def get_patch_transform(self): return transforms.IdentityTransform() - + def getpoints(self, x1,y1,x2,y2, k): """ for line segment defined by x1,y1 and x2,y2, return the points on @@ -845,7 +845,7 @@ .scale(self._width * 0.5, self._height * 0.5) \ .rotate_deg(self._angle) \ .translate(*self._center) - + def get_path(self): """ Return the vertices of the rectangle @@ -854,12 +854,12 @@ def get_patch_transform(self): return self._patch_transform - + def contains(self,ev): if ev.x is None or ev.y is None: return False,{} x, y = self.get_transform().inverted().transform_point((ev.x, ev.y)) return (x*x + y*y) <= 1.0, {} - + def _get_center(self): return self._center def _set_center(self, center): @@ -880,8 +880,8 @@ self._angle = angle self._recompute_transform() angle = property(_get_angle, _set_angle) - - + + class Circle(Ellipse): """ A circle patch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4524 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4524&view=rev Author: mdboom Date: 2007年11月30日 07:50:35 -0800 (2007年11月30日) Log Message: ----------- Fix bb numerals in mathtext. Modified Paths: -------------- branches/transforms/lib/matplotlib/_mathtext_data.py Modified: branches/transforms/lib/matplotlib/_mathtext_data.py =================================================================== --- branches/transforms/lib/matplotlib/_mathtext_data.py 2007年11月30日 15:50:13 UTC (rev 4523) +++ branches/transforms/lib/matplotlib/_mathtext_data.py 2007年11月30日 15:50:35 UTC (rev 4524) @@ -88,7 +88,7 @@ r'\phi' : ('cmmi10', 42), r'\chi' : ('cmmi10', 17), r'\psi' : ('cmmi10', 31), - + r'(' : ('cmr10', 119), r'\leftparen' : ('cmr10', 119), r'\rightparen' : ('cmr10', 68), @@ -127,7 +127,7 @@ r'\Phi' : ('cmr10', 9), r'\Psi' : ('cmr10', 15), r'\Omega' : ('cmr10', 12), - + # these are mathml names, I think. I'm just using them for the # tex methods noted r'\circumflexaccent' : ('cmr10', 124), # for \hat @@ -398,7 +398,7 @@ r'\}' : ('pncr8a', 125), r'\backslash' : ('pncr8a', 92), r'\ast' : ('pncr8a', 42), - + r'\circumflexaccent' : ('pncri8a', 124), # for \hat r'\combiningbreve' : ('pncri8a', 81), # for \breve r'\combininggraveaccent' : ('pncri8a', 114), # for \grave @@ -2071,7 +2071,7 @@ 'rightzigzagarrow': 8669, 'rightarrow': 8594, 'leftarrow': 8592, -'__sqrt__': 8730, +'__sqrt__': 8730, 'twoheaddownarrow': 8609, 'oint': 8750, 'bigvee': 8897, @@ -2236,7 +2236,7 @@ '{': 123, '}': 125, '_': 95, -'imath': 0x131, +'imath': 0x131, 'circumflexaccent' : 770, 'combiningbreve' : 774, 'combiningoverline' : 772, @@ -2294,6 +2294,7 @@ ], 'it': [ + (0x0030, 0x0039, 'rm', 0x1d7d8), # 0-9 (0x0041, 0x0041, 'it', 0xe154), # A-B (0x0043, 0x0043, 'it', 0x2102), # C (missing in beta STIX fonts) (0x0044, 0x0044, 'it', 0x2145), # D @@ -2469,5 +2470,5 @@ (0x0061, 0x007a, 'rm', 0x1d68a) # a-z ], } - - + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4523 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4523&view=rev Author: mdboom Date: 2007年11月30日 07:50:13 -0800 (2007年11月30日) Log Message: ----------- Cleanup some variable names. Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_pdf.py Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007年11月30日 15:13:44 UTC (rev 4522) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007年11月30日 15:50:13 UTC (rev 4523) @@ -682,12 +682,12 @@ descriptor['MaxWidth'] = max(widths) # Make the "Differences" array, sort the ccodes < 255 from - # the two-byte ccodes, and build the whole set of glyph ids + # the multi-byte ccodes, and build the whole set of glyph ids # that we need from this font. cmap = font.get_charmap() glyph_ids = [] differences = [] - two_byte_chars = Set() + multi_byte_chars = Set() for c in characters: ccode = ord(c) gind = cmap.get(ccode) or 0 @@ -696,7 +696,7 @@ if ccode <= 255: differences.append((ccode, glyph_name)) else: - two_byte_chars.add(glyph_name) + multi_byte_chars.add(glyph_name) differences.sort() last_c = -2 @@ -715,7 +715,7 @@ charprocDict = { 'Length': len(stream) } # The 2-byte characters are used as XObjects, so they # need extra info in their dictionary - if charname in two_byte_chars: + if charname in multi_byte_chars: charprocDict['Type'] = Name('XObject') charprocDict['Subtype'] = Name('Form') charprocDict['BBox'] = bbox @@ -726,9 +726,9 @@ # Send the glyphs with ccode > 255 to the XObject dictionary, # and the others to the font itself - if charname in two_byte_chars: + if charname in multi_byte_chars: name = self._get_xobject_symbol_name(filename, charname) - self.two_byte_charprocs[name] = charprocObject + self.multi_byte_charprocs[name] = charprocObject else: charprocs[charname] = charprocObject @@ -1297,7 +1297,7 @@ self.file.output(self.encode_string(unichr(num), fonttype), Op.show) self.file.output(Op.end_text) - # If using Type 3 fonts, render all of the two-byte characters + # If using Type 3 fonts, render all of the multi-byte characters # as XObjects using the 'Do' command. if global_fonttype == 3: for ox, oy, fontname, fontsize, num, symbol_name in glyphs: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4522 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4522&view=rev Author: jswhit Date: 2007年11月30日 07:13:44 -0800 (2007年11月30日) Log Message: ----------- fill continents and oceans. Modified Paths: -------------- trunk/toolkits/basemap/examples/garp.py Modified: trunk/toolkits/basemap/examples/garp.py =================================================================== --- trunk/toolkits/basemap/examples/garp.py 2007年11月30日 15:06:56 UTC (rev 4521) +++ trunk/toolkits/basemap/examples/garp.py 2007年11月30日 15:13:44 UTC (rev 4522) @@ -24,9 +24,11 @@ m = Basemap(width=width,height=width,\ resolution='c',projection='aeqd',\ lat_0=lat_0,lon_0=lon_0) +# fill background. +m.drawmapboundary(fill_color='aqua') # draw coasts and fill continents. m.drawcoastlines(linewidth=0.5) -m.fillcontinents() +m.fillcontinents(color='coral',lake_color='aqua') # 20 degree graticule. m.drawparallels(arange(-80,81,20)) m.drawmeridians(arange(-180,180,20)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4521 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4521&view=rev Author: mdboom Date: 2007年11月30日 07:06:56 -0800 (2007年11月30日) Log Message: ----------- Get Gtk backend working. Modified Paths: -------------- branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/backends/backend_gdk.py branches/transforms/lib/matplotlib/path.py branches/transforms/src/_path.cpp Modified: branches/transforms/lib/matplotlib/axis.py =================================================================== --- branches/transforms/lib/matplotlib/axis.py 2007年11月30日 14:43:11 UTC (rev 4520) +++ branches/transforms/lib/matplotlib/axis.py 2007年11月30日 15:06:56 UTC (rev 4521) @@ -87,7 +87,7 @@ self._size = size self._padPixels = self.figure.dpi * self._pad * (1/72.0) - + self.tick1line = self._get_tick1line() self.tick2line = self._get_tick2line() self.gridline = self._get_gridline() @@ -97,7 +97,7 @@ self.label2 = self._get_text2() self.update_position(loc) - + self.gridOn = gridOn self.tick1On = tick1On self.tick2On = tick2On @@ -114,7 +114,7 @@ #self.tick2line.set_clip_path(clippath, transform) self.gridline.set_clip_path(clippath, transform) set_clip_path.__doc__ = Artist.set_clip_path.__doc__ - + def contains(self, mouseevent): """Test whether the mouse event occured in the Tick marks. @@ -189,7 +189,7 @@ """ self.label1.set_text(s) set_label = set_label1 - + def set_label2(self, s): """ Set the text of ticklabel2 @@ -209,7 +209,7 @@ def set_view_interval(self, vmin, vmax, ignore=False): raise NotImplementedError('Derived must override') - + class XTick(Tick): """ Contains all the Artists needed to make an x tick - the tick line, @@ -223,7 +223,7 @@ # x in data coords, y in axes coords #t = Text( trans, vert, horiz = self.axes.get_xaxis_text1_transform(self._padPixels) - + t = TextWithDash( x=0, y=0, fontproperties=FontProperties(size=rcParams['xtick.labelsize']), @@ -320,10 +320,10 @@ else: Vmin, Vmax = self.get_view_interval() self.axes.viewLim.intervalx = min(vmin, Vmin), max(vmax, Vmax) - + def get_minpos(self): return self.axes.dataLim.minposx - + def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.dataLim.intervalx @@ -428,7 +428,7 @@ self._loc = loc - + def get_view_interval(self): 'return the Interval instance for this axis view limits' return self.axes.viewLim.intervaly @@ -439,10 +439,10 @@ else: Vmin, Vmax = self.get_view_interval() self.axes.viewLim.intervaly = min(vmin, Vmin), max(vmax, Vmax) - + def get_minpos(self): return self.axes.dataLim.minposy - + def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.dataLim.intervaly @@ -465,7 +465,7 @@ """ LABELPAD = 5 OFFSETTEXTPAD = 3 - + def __str__(self): return str(self.__class__).split('.')[-1] \ + "(%d,%d)"%self.axes.transAxes.xy_tup((0,0)) @@ -493,23 +493,23 @@ self.majorTicks = [] self.minorTicks = [] self.pickradius = pickradius - + self.cla() self.set_scale('linear') - + def get_transform(self): return self._scale.get_transform() def get_scale(self): return self._scale.name - + def set_scale(self, value, **kwargs): self._scale = scale_factory(value, self, **kwargs) self._scale.set_default_locators_and_formatters(self) def limit_range_for_scale(self, vmin, vmax): return self._scale.limit_range_for_scale(vmin, vmax, self.get_minpos()) - + def get_children(self): children = [self.label] majorticks = self.get_major_ticks() @@ -547,7 +547,7 @@ self.minorTicks.extend([self._get_tick(major=False)]) self._lastNumMajorTicks = 1 self._lastNumMinorTicks = 1 - + self.converter = None self.units = None self.set_units(None) @@ -555,17 +555,17 @@ def set_clip_path(self, clippath, transform=None): Artist.set_clip_path(self, clippath, transform) majorticks = self.get_major_ticks() - minorticks = self.get_minor_ticks() + minorticks = self.get_minor_ticks() for child in self.majorTicks + self.minorTicks: child.set_clip_path(clippath, transform) - + def get_view_interval(self): 'return the Interval instance for this axis view limits' raise NotImplementedError('Derived must override') def set_view_interval(self, vmin, vmax, ignore=False): raise NotImplementedError('Derived must override') - + def get_data_interval(self): 'return the Interval instance for this axis data limits' raise NotImplementedError('Derived must override') @@ -573,7 +573,7 @@ def set_data_interval(self): 'Set the axis data limits' raise NotImplementedError('Derived must override') - + def _set_artist_props(self, a): if a is None: return a.set_figure(self.figure) @@ -774,7 +774,7 @@ for i in range(numticks - len(self.majorTicks)): tick = self._get_tick(major=True) self.majorTicks.append(tick) - + if self._lastNumMajorTicks < numticks: protoTick = self.majorTicks[0] for i in range(self._lastNumMajorTicks, len(self.majorTicks)): @@ -798,7 +798,7 @@ for i in range(numticks - len(self.minorTicks)): tick = self._get_tick(major=False) self.minorTicks.append(tick) - + if self._lastNumMinorTicks < numticks: protoTick = self.minorTicks[0] for i in range(self._lastNumMinorTicks, len(self.minorTicks)): @@ -1039,7 +1039,7 @@ class XAxis(Axis): __name__ = 'xaxis' axis_name = 'x' - + def contains(self,mouseevent): """Test whether the mouse event occured in the x axis. """ @@ -1120,7 +1120,7 @@ bbox = Bbox.union(bboxes) bottom = bbox.y0 self.label.set_position( (x, bottom - self.LABELPAD*self.figure.dpi / 72.0)) - + else: if not len(bboxes2): top = self.axes.bbox.ymax @@ -1141,7 +1141,7 @@ bbox = Bbox.union(bboxes) bottom = bbox.y0 self.offsetText.set_position((x, bottom-self.OFFSETTEXTPAD*self.figure.dpi/72.0)) - + def set_ticks_position(self, position): """ Set the ticks position (top, bottom, both, default or none) @@ -1224,10 +1224,10 @@ else: Vmin, Vmax = self.get_view_interval() self.axes.viewLim.intervalx = min(vmin, Vmin), max(vmax, Vmax) - + def get_minpos(self): return self.axes.dataLim.minposx - + def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.dataLim.intervalx @@ -1244,7 +1244,7 @@ class YAxis(Axis): __name__ = 'yaxis' axis_name = 'y' - + def contains(self,mouseevent): """Test whether the mouse event occurred in the y axis. @@ -1331,7 +1331,7 @@ left = bbox.x0 self.label.set_position( (left-self.LABELPAD*self.figure.dpi/72.0, y)) - + else: if not len(bboxes2): right = self.axes.bbox.xmax @@ -1349,7 +1349,7 @@ x,y = self.offsetText.get_position() top = self.axes.bbox.ymax self.offsetText.set_position((x, top+self.OFFSETTEXTPAD*self.figure.dpi/72.0)) - + def set_offset_position(self, position): assert position == 'left' or position == 'right' @@ -1445,10 +1445,10 @@ else: Vmin, Vmax = self.get_view_interval() self.axes.viewLim.intervaly = min(vmin, Vmin), max(vmax, Vmax) - + def get_minpos(self): return self.axes.dataLim.minposy - + def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.dataLim.intervaly Modified: branches/transforms/lib/matplotlib/backends/backend_gdk.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_gdk.py 2007年11月30日 14:43:11 UTC (rev 4520) +++ branches/transforms/lib/matplotlib/backends/backend_gdk.py 2007年11月30日 15:06:56 UTC (rev 4521) @@ -25,7 +25,7 @@ from matplotlib.cbook import is_string_like, enumerate from matplotlib.figure import Figure from matplotlib.mathtext import MathTextParser - +from matplotlib.transforms import Affine2D from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array @@ -81,23 +81,25 @@ """ self.width, self.height = width, height - def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation): - x, y = int(x-0.5*width), self.height-int(y+0.5*height) - w, h = int(width)+1, int(height)+1 - a1, a2 = int(angle1*64), int(angle2*64) + def draw_path(self, gc, path, transform, rgbFace=None): + transform = transform + Affine2D(). \ + scale(1.0, -1.0).translate(0, self.height) + polygons = path.to_polygons(transform) + for polygon in polygons: + # draw_polygon won't take an arbitrary sequence -- it must be a list + # of tuples + polygon = [(int(round(x)), int(round(y))) for x, y in polygon] + if rgbFace is not None: + saveColor = gc.gdkGC.foreground + gc.gdkGC.foreground = gc.rgb_to_gdk_color(rgbFace) + self.gdkDrawable.draw_polygon(gc.gdkGC, True, polygon) + gc.gdkGC.foreground = saveColor + if gc.gdkGC.line_width > 0: + self.gdkDrawable.draw_lines(gc.gdkGC, polygon) - if rgbFace: - saveColor = gc.gdkGC.foreground - gc.gdkGC.foreground = gc.rgb_to_gdk_color(rgbFace) - self.gdkDrawable.draw_arc(gc.gdkGC, True, x, y, w, h, a1, a2) - gc.gdkGC.foreground = saveColor - if gc.gdkGC.line_width > 0: - self.gdkDrawable.draw_arc(gc.gdkGC, False, x, y, w, h, a1, a2) - - - def draw_image(self, x, y, im, bbox): + def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): if bbox != None: - l,b,w,h = bbox.get_bounds() + l,b,w,h = bbox.bounds #rectangle = (int(l), self.height-int(b+h), # int(w), int(h)) # set clip rect? @@ -135,48 +137,6 @@ im.flipud_out() - def draw_line(self, gc, x1, y1, x2, y2): - if gc.gdkGC.line_width > 0: - self.gdkDrawable.draw_line(gc.gdkGC, int(x1), self.height-int(y1), - int(x2), self.height-int(y2)) - - - def draw_lines(self, gc, x, y, transform=None): - if gc.gdkGC.line_width > 0: - x = x.astype(npy.int16) - y = self.height - y.astype(npy.int16) - self.gdkDrawable.draw_lines(gc.gdkGC, zip(x,y)) - - - def draw_point(self, gc, x, y): - self.gdkDrawable.draw_point(gc.gdkGC, int(x), self.height-int(y)) - - - def draw_polygon(self, gc, rgbFace, points): - points = [(int(x), self.height-int(y)) for x,y in points] - if rgbFace: - saveColor = gc.gdkGC.foreground - gc.gdkGC.foreground = gc.rgb_to_gdk_color(rgbFace) - self.gdkDrawable.draw_polygon(gc.gdkGC, True, points) - gc.gdkGC.foreground = saveColor - if gc.gdkGC.line_width > 0: - self.gdkDrawable.draw_polygon(gc.gdkGC, False, points) - - - def draw_rectangle(self, gc, rgbFace, x, y, width, height): - x, y = int(x), self.height-int(y+height) - #x, y = int(x), self.height-int(math.ceil(y+height)) - w, h = int(math.ceil(width)), int(math.ceil(height)) - - if rgbFace: - saveColor = gc.gdkGC.foreground - gc.gdkGC.foreground = gc.rgb_to_gdk_color(rgbFace) - self.gdkDrawable.draw_rectangle(gc.gdkGC, True, x, y, w, h) - gc.gdkGC.foreground = saveColor - if gc.gdkGC.line_width > 0: - self.gdkDrawable.draw_rectangle(gc.gdkGC, False, x, y, w, h) - - def draw_text(self, gc, x, y, s, prop, angle, ismath): x, y = int(x), int(y) @@ -200,7 +160,7 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle): ox, oy, width, height, descent, font_image, used_characters = \ - self.mathtext_parser.parse(s, self.dpi.get(), prop) + self.mathtext_parser.parse(s, self.dpi, prop) if angle==90: width, height = height, width @@ -213,7 +173,7 @@ # a numpixels by num fonts array Xall = npy.zeros((N,1), npy.uint8) - + image_str = font_image.as_str() Xall[:,0] = npy.fromstring(image_str, npy.uint8) @@ -310,12 +270,12 @@ # two (not one) layouts are created for every text item s (then they # are cached) - why? - key = self.dpi.get(), s, hash(prop) + key = self.dpi, s, hash(prop) value = self.layoutd.get(key) if value != None: return value - size = prop.get_size_in_points() * self.dpi.get() / 96.0 + size = prop.get_size_in_points() * self.dpi / 96.0 size = round(size) font_str = '%s, %s %i' % (prop.get_name(), prop.get_style(), size,) @@ -341,7 +301,7 @@ def get_text_width_height_descent(self, s, prop, ismath): if ismath: ox, oy, width, height, descent, font_image, used_characters = \ - self.mathtext_parser.parse(s, self.dpi.get(), prop) + self.mathtext_parser.parse(s, self.dpi, prop) return width, height, descent layout, inkRect, logicalRect = self._get_pango_layout(s, prop) @@ -386,9 +346,9 @@ return an allocated gtk.gdk.Color """ try: - return self._cached[rgb] + return self._cached[tuple(rgb)] except KeyError: - color = self._cached[rgb] = \ + color = self._cached[tuple(rgb)] = \ self._cmap.alloc_color( int(rgb[0]*65535),int(rgb[1]*65535),int(rgb[2]*65535)) return color @@ -404,14 +364,15 @@ def set_clip_rectangle(self, rectangle): GraphicsContextBase.set_clip_rectangle(self, rectangle) - l,b,w,h = rectangle + if rectangle is None: + return + l,b,w,h = rectangle.bounds rectangle = (int(l), self.renderer.height-int(b+h)+1, int(w), int(h)) #rectangle = (int(l), self.renderer.height-int(b+h), # int(w+1), int(h+2)) self.gdkGC.set_clip_rectangle(rectangle) - def set_dashes(self, dash_offset, dash_list): GraphicsContextBase.set_dashes(self, dash_offset, dash_list) @@ -486,7 +447,7 @@ def print_png(self, filename, *args, **kwargs): return self._print_image(filename, 'png') - + def _print_image(self, filename, format, *args, **kwargs): width, height = self.get_width_height() pixmap = gtk.gdk.Pixmap (None, width, height, depth=24) @@ -500,4 +461,6 @@ 0, 0, 0, 0, width, height) pixbuf.save(filename, format) - + + def get_default_filetype(self): + return 'png' Modified: branches/transforms/lib/matplotlib/path.py =================================================================== --- branches/transforms/lib/matplotlib/path.py 2007年11月30日 14:43:11 UTC (rev 4520) +++ branches/transforms/lib/matplotlib/path.py 2007年11月30日 15:06:56 UTC (rev 4521) @@ -12,7 +12,7 @@ from matplotlib._path import point_in_path, get_path_extents, \ point_in_path_collection, get_path_collection_extents, \ - path_in_path, path_intersects_path + path_in_path, path_intersects_path, convert_path_to_polygons from matplotlib.cbook import simple_linear_interpolation KAPPA = 4.0 * (npy.sqrt(2) - 1) / 3.0 @@ -210,19 +210,17 @@ If transform is not None, the path will be transformed before performing the test. """ - if transform is None: - from transforms import IdentityTransform - transform = IdentityTransform() - return point_in_path(point[0], point[1], self, transform.frozen()) + if transform is not None: + transform = transform.frozen() + return point_in_path(point[0], point[1], self, transform) def contains_path(self, path, transform=None): """ Returns True if this path completely contains the given path. """ - if transform is None: - from transforms import IdentityTransform - transform = IdentityTransform() - return path_in_path(self, IdentityTransform(), path, transform) + if transform is not None: + transform = transform.frozen() + return path_in_path(self, None, path, transform) def get_extents(self, transform=None): """ @@ -232,9 +230,9 @@ algorithm will take into account the curves and deal with control points appropriately. """ - from transforms import Affine2D, Bbox - if transform is None: - transform = Affine2D() + from transforms import Bbox + if transform is not None: + transform = transform.frozen() return Bbox(get_path_extents(self, transform)) def intersects_path(self, other): @@ -267,6 +265,23 @@ new_codes = None return Path(vertices, new_codes) + def to_polygons(self, transform=None): + """ + Convert this path to a list of polygons. Each polygon is an + Nx2 array of vertices. In other words, each polygon has no + "move to" instructions or curves. + """ + if transform is not None: + transform = transform.frozen() + # Deal with the common and simple case + if self.codes is None: + if len(self.vertices): + return [transform.transform(self.vertices)] + return [] + # Deal with the case where there are curves and/or multiple + # subpaths (using extension code) + return convert_path_to_polygons(self, transform) + _unit_rectangle = None #@classmethod def unit_rectangle(cls): Modified: branches/transforms/src/_path.cpp =================================================================== --- branches/transforms/src/_path.cpp 2007年11月30日 14:43:11 UTC (rev 4520) +++ branches/transforms/src/_path.cpp 2007年11月30日 15:06:56 UTC (rev 4521) @@ -48,6 +48,8 @@ "count_bboxes_overlapping_bbox(bbox, bboxes)"); add_varargs_method("path_intersects_path", &_path_module::path_intersects_path, "path_intersects_path(p1, p2)"); + add_varargs_method("convert_path_to_polygons", &_path_module::convert_path_to_polygons, + "convert_path_to_polygons(path, trans)"); initialize("Helper functions for paths"); } @@ -66,6 +68,7 @@ Py::Object affine_transform(const Py::Tuple& args); Py::Object count_bboxes_overlapping_bbox(const Py::Tuple& args); Py::Object path_intersects_path(const Py::Tuple& args); + Py::Object convert_path_to_polygons(const Py::Tuple& args); }; // @@ -137,7 +140,7 @@ code = path.vertex(&x, &y); // The following cases denote the beginning on a new subpath - if (code == agg::path_cmd_stop || + if (code == agg::path_cmd_stop || (code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) { x = sx; @@ -234,7 +237,7 @@ double x = Py::Float(args[0]); double y = Py::Float(args[1]); PathIterator path(args[2]); - agg::trans_affine trans = py_to_agg_transformation_matrix(args[3]); + agg::trans_affine trans = py_to_agg_transformation_matrix(args[3], false); if (::point_in_path(x, y, path, trans)) return Py::Int(1); @@ -623,9 +626,9 @@ args.verify_length(4); PathIterator a(args[0]); - agg::trans_affine atrans = py_to_agg_transformation_matrix(args[1]); + agg::trans_affine atrans = py_to_agg_transformation_matrix(args[1], false); PathIterator b(args[2]); - agg::trans_affine btrans = py_to_agg_transformation_matrix(args[3]); + agg::trans_affine btrans = py_to_agg_transformation_matrix(args[3], false); return Py::Int(::path_in_path(a, atrans, b, btrans)); } @@ -1091,6 +1094,68 @@ return Py::Int(1); } +void _add_polygon(Py::List& polygons, const std::vector<double>& polygon) { + if (polygon.size() == 0) + return; + npy_intp polygon_dims[] = { polygon.size() / 2, 2, 0 }; + double* polygon_data = new double[polygon.size()]; + memcpy(polygon_data, &polygon[0], polygon.size() * sizeof(double)); + PyArrayObject* polygon_array = NULL; + polygon_array = (PyArrayObject*)PyArray_SimpleNewFromData + (2, polygon_dims, PyArray_DOUBLE, polygon_data); + if (!polygon_array) + { + delete[] polygon_data; + throw Py::RuntimeError("Error creating polygon array"); + } + polygons.append(Py::Object((PyObject*)polygon_array)); +} + +Py::Object _path_module::convert_path_to_polygons(const Py::Tuple& args) +{ + typedef agg::conv_transform<PathIterator> transformed_path_t; + typedef agg::conv_curve<transformed_path_t> curve_t; + + typedef std::vector<double> vertices_t; + + args.verify_length(2); + + PathIterator path(args[0]); + agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); + + transformed_path_t tpath(path, trans); + curve_t curve(tpath); + + Py::List polygons; + vertices_t polygon; + double x, y; + unsigned code; + + while ((code = curve.vertex(&x, &y)) != agg::path_cmd_stop) + { + if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) { + if (polygon.size() >= 2) + { + polygon.push_back(polygon[0]); + polygon.push_back(polygon[1]); + _add_polygon(polygons, polygon); + } + polygon.clear(); + } else { + if (code == agg::path_cmd_move_to) { + _add_polygon(polygons, polygon); + polygon.clear(); + } + polygon.push_back(x); + polygon.push_back(y); + } + } + + _add_polygon(polygons, polygon); + + return polygons; +} + extern "C" DL_EXPORT(void) init_path(void) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4520 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4520&view=rev Author: jswhit Date: 2007年11月30日 06:43:11 -0800 (2007年11月30日) Log Message: ----------- remove numerix imports Modified Paths: -------------- trunk/toolkits/basemap/examples/ccsm_popgrid.py trunk/toolkits/basemap/examples/fcstmaps.py trunk/toolkits/basemap/examples/fillstates.py trunk/toolkits/basemap/examples/plotmap_masked.py trunk/toolkits/basemap/examples/plotmap_oo.py trunk/toolkits/basemap/examples/simpletest_oo.py Modified: trunk/toolkits/basemap/examples/ccsm_popgrid.py =================================================================== --- trunk/toolkits/basemap/examples/ccsm_popgrid.py 2007年11月30日 14:36:43 UTC (rev 4519) +++ trunk/toolkits/basemap/examples/ccsm_popgrid.py 2007年11月30日 14:43:11 UTC (rev 4520) @@ -22,13 +22,8 @@ """ import pylab as pl from matplotlib import rcParams -try: - import numpy - rcParams['numerix'] = 'numpy' -except: - raise ImportError('this example requires numpy') -import matplotlib.numerix.ma as MA -import matplotlib.numerix as N +from numpy import ma as MA +import numpy as N from matplotlib.toolkits.basemap import Basemap, NetCDFFile # read in data from netCDF file. Modified: trunk/toolkits/basemap/examples/fcstmaps.py =================================================================== --- trunk/toolkits/basemap/examples/fcstmaps.py 2007年11月30日 14:36:43 UTC (rev 4519) +++ trunk/toolkits/basemap/examples/fcstmaps.py 2007年11月30日 14:43:11 UTC (rev 4520) @@ -4,7 +4,7 @@ meshgrid, axes, colorbar import numpy import sys -from matplotlib.numerix import ma +from numpy import ma import datetime from matplotlib.toolkits.basemap import Basemap, NetCDFFile, addcyclic Modified: trunk/toolkits/basemap/examples/fillstates.py =================================================================== --- trunk/toolkits/basemap/examples/fillstates.py 2007年11月30日 14:36:43 UTC (rev 4519) +++ trunk/toolkits/basemap/examples/fillstates.py 2007年11月30日 14:43:11 UTC (rev 4520) @@ -1,5 +1,5 @@ import pylab as p -import matplotlib.numerix as nx +import numpy from matplotlib.toolkits.basemap import Basemap as Basemap from matplotlib.colors import rgb2hex from matplotlib.patches import Polygon @@ -90,7 +90,7 @@ poly = Polygon(seg,facecolor=color,edgecolor=color) ax.add_patch(poly) # draw meridians and parallels. -m.drawparallels(nx.arange(25,65,20),labels=[1,0,0,0]) -m.drawmeridians(nx.arange(-120,-40,20),labels=[0,0,0,1]) +m.drawparallels(numpy.arange(25,65,20),labels=[1,0,0,0]) +m.drawmeridians(numpy.arange(-120,-40,20),labels=[0,0,0,1]) p.title('Filling State Polygons by Population Density') p.show() Modified: trunk/toolkits/basemap/examples/plotmap_masked.py =================================================================== --- trunk/toolkits/basemap/examples/plotmap_masked.py 2007年11月30日 14:36:43 UTC (rev 4519) +++ trunk/toolkits/basemap/examples/plotmap_masked.py 2007年11月30日 14:43:11 UTC (rev 4520) @@ -8,7 +8,7 @@ from matplotlib.toolkits.basemap import Basemap, shiftgrid from pylab import title, colorbar, show, axes, cm, load, arange, figure, \ text, where -from matplotlib.numerix import ma +from numpy import ma import matplotlib.colors as colors # read in topo data (on a regular lat/lon grid) Modified: trunk/toolkits/basemap/examples/plotmap_oo.py =================================================================== --- trunk/toolkits/basemap/examples/plotmap_oo.py 2007年11月30日 14:36:43 UTC (rev 4519) +++ trunk/toolkits/basemap/examples/plotmap_oo.py 2007年11月30日 14:43:11 UTC (rev 4520) @@ -14,7 +14,7 @@ from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.toolkits.basemap import Basemap, shiftgrid from matplotlib.figure import Figure -import matplotlib.numerix as NX +import numpy import matplotlib.cm as cm from matplotlib.mlab import load @@ -57,9 +57,9 @@ m.drawstates() # draw parallels and meridians. # label on left, right and bottom of map. -parallels = NX.arange(0.,80,20.) +parallels = numpy.arange(0.,80,20.) m.drawparallels(parallels,labels=[1,1,0,1]) -meridians = NX.arange(10.,360.,30.) +meridians = numpy.arange(10.,360.,30.) m.drawmeridians(meridians,labels=[1,1,0,1]) # set title. ax.set_title('ETOPO Topography - Lambert Conformal Conic') Modified: trunk/toolkits/basemap/examples/simpletest_oo.py =================================================================== --- trunk/toolkits/basemap/examples/simpletest_oo.py 2007年11月30日 14:36:43 UTC (rev 4519) +++ trunk/toolkits/basemap/examples/simpletest_oo.py 2007年11月30日 14:43:11 UTC (rev 4520) @@ -7,8 +7,7 @@ from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.toolkits.basemap import Basemap from matplotlib.figure import Figure -from numpy import meshgrid -import matplotlib.numerix as nx +import numpy import matplotlib.cm as cm from matplotlib.mlab import load @@ -26,15 +25,15 @@ # set 'ax' keyword so pylab won't be imported. m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1]),ax=ax) # make filled contour plot. -x, y = m(*meshgrid(lons, lats)) +x, y = m(*numpy.meshgrid(lons, lats)) cs = m.contourf(x,y,etopo,30,cmap=cm.jet) # draw coastlines. m.drawcoastlines() # draw a line around the map region. m.drawmapboundary() # draw parallels and meridians. -m.drawparallels(nx.arange(-60.,90.,30.),labels=[1,0,0,0],fontsize=10) -m.drawmeridians(nx.arange(0.,420.,60.),labels=[0,0,0,1],fontsize=10) +m.drawparallels(numpy.arange(-60.,90.,30.),labels=[1,0,0,0],fontsize=10) +m.drawmeridians(numpy.arange(0.,420.,60.),labels=[0,0,0,1],fontsize=10) # add a title. ax.set_title('Robinson Projection') # add a colorbar. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4519 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4519&view=rev Author: jswhit Date: 2007年11月30日 06:36:43 -0800 (2007年11月30日) Log Message: ----------- no Float32 anymore Modified Paths: -------------- trunk/toolkits/basemap/examples/pnganim.py trunk/toolkits/basemap/examples/warpimage.py Modified: trunk/toolkits/basemap/examples/pnganim.py =================================================================== --- trunk/toolkits/basemap/examples/pnganim.py 2007年11月30日 12:58:57 UTC (rev 4518) +++ trunk/toolkits/basemap/examples/pnganim.py 2007年11月30日 14:36:43 UTC (rev 4519) @@ -2,15 +2,13 @@ # as an animation using a tool like imagemagick animate, or # converted to an animate gif (using imagemagick convert). -# requires pydap module. -try: - from dap import client -except: - raise ImportError,"requires pyDAP module (version 2.1 or higher) from http://pydap.org" -import pylab as p -from matplotlib.numerix import ma +# reads data over http - needs an active internet connection. + +import numpy +import pylab +from numpy import ma import datetime, sys, time, subprocess -from matplotlib.toolkits.basemap import Basemap, shiftgrid +from matplotlib.toolkits.basemap import Basemap, shiftgrid, NetCDFFile hrsgregstart = 13865688 # hrs from 00010101 to 15821015 in Julian calendar. # times in many datasets use mixed Gregorian/Julian calendar, datetime @@ -55,19 +53,19 @@ print URLu print URLv try: - data = client.open(URL) - datau = client.open(URLu) - datav = client.open(URLv) + data = NetCDFFile(URL) + datau = NetCDFFile(URLu) + datav = NetCDFFile(URLv) except: raise IOError, 'opendap server not providing the requested data' # read lats,lons,times. -print data.keys() -print datau.keys() -print datav.keys() -latitudes = data['lat'][:] -longitudes = data['lon'][:].tolist() -times = data['time'][:] +print data.variables.keys() +print datau.variables.keys() +print datav.variables.keys() +latitudes = data.variables['lat'][:] +longitudes = data.variables['lon'][:].tolist() +times = data.variables['time'][:] # put times in YYYYMMDDHH format. dates=[] for t in times: @@ -83,49 +81,49 @@ if ntime1 >= ntime2: raise ValueError,'date2 must be greater than date1' # get sea level pressure and 10-m wind data. -slpdata = data['presmsl'] -udata = datau['ugrdprs'] -vdata = datau['vgrdprs'] +slpdata = data.variables['presmsl'] +udata = datau.variables['ugrdprs'] +vdata = datau.variables['vgrdprs'] # mult slp by 0.01 to put in units of millibars. -slpin = 0.01*p.squeeze(slpdata[ntime1:ntime2+1,:,:]) -uin = p.squeeze(udata[ntime1:ntime2+1,0,:,:]) -vin = p.squeeze(vdata[ntime1:ntime2+1,0,:,:]) +slpin = 0.01*slpdata[ntime1:ntime2+1,:,:] +uin = udata[ntime1:ntime2+1,0,:,:] +vin = vdata[ntime1:ntime2+1,0,:,:] datelabels = dates[ntime1:ntime2+1] # add cyclic points -slp = p.zeros((slpin.shape[0],slpin.shape[1],slpin.shape[2]+1),p.Float64) +slp = numpy.zeros((slpin.shape[0],slpin.shape[1],slpin.shape[2]+1),numpy.float64) slp[:,:,0:-1] = slpin; slp[:,:,-1] = slpin[:,:,0] -u = p.zeros((uin.shape[0],uin.shape[1],uin.shape[2]+1),p.Float64) +u = numpy.zeros((uin.shape[0],uin.shape[1],uin.shape[2]+1),numpy.float64) u[:,:,0:-1] = uin; u[:,:,-1] = uin[:,:,0] -v = p.zeros((vin.shape[0],vin.shape[1],vin.shape[2]+1),p.Float64) +v = numpy.zeros((vin.shape[0],vin.shape[1],vin.shape[2]+1),numpy.float64) v[:,:,0:-1] = vin; v[:,:,-1] = vin[:,:,0] -longitudes.append(360.); longitudes = p.array(longitudes) +longitudes.append(360.); longitudes = numpy.array(longitudes) # make 2-d grid of lons, lats -lons, lats = p.meshgrid(longitudes,latitudes) +lons, lats = numpy.meshgrid(longitudes,latitudes) print 'min/max slp,u,v' -print min(p.ravel(slp)),max(p.ravel(slp)) -print min(p.ravel(uin)),max(p.ravel(uin)) -print min(p.ravel(vin)),max(p.ravel(vin)) +print slp.min(), slp.max() +print uin.min(), uin.max() +print vin.min(), vin.max() print 'dates' print datelabels -# make orthographic basemap. +# make orthographic basemapylab. m = Basemap(resolution='c',projection='ortho',lat_0=60.,lon_0=-60.) -p.ion() # interactive mode on. -uin = p.squeeze(udata[ntime1:ntime2+1,0,:,:]) -vin = p.squeeze(vdata[ntime1:ntime2+1,0,:,:]) +pylab.ion() # interactive mode on. +uin = udata[ntime1:ntime2+1,0,:,:] +vin = vdata[ntime1:ntime2+1,0,:,:] datelabels = dates[ntime1:ntime2+1] -# make orthographic basemap. +# make orthographic basemapylab. m = Basemap(resolution='c',projection='ortho',lat_0=60.,lon_0=-60.) -p.ion() # interactive mode on. +pylab.ion() # interactive mode on. # create figure, add axes (leaving room for colorbar on right) -fig = p.figure() +fig = pylab.figure() ax = fig.add_axes([0.1,0.1,0.7,0.7]) # set desired contour levels. -clevs = p.arange(960,1061,5) +clevs = numpy.arange(960,1061,5) # compute native x,y coordinates of grid. x, y = m(lons, lats) # define parallels and meridians to draw. -parallels = p.arange(-80.,90,20.) -meridians = p.arange(0.,360.,20.) +parallels = numpy.arange(-80.,90,20.) +meridians = numpy.arange(0.,360.,20.) # number of repeated frames at beginning and end is n1. nframe = 0; n1 = 10 l,b,w,h=ax.get_position() @@ -133,42 +131,42 @@ # parallels, meridians and title. for nt,date in enumerate(datelabels[1:]): CS = m.contour(x,y,slp[nt,:,:],clevs,linewidths=0.5,colors='k',animated=True) - CS = m.contourf(x,y,slp[nt,:,:],clevs,cmap=p.cm.RdBu_r,animated=True) + CS = m.contourf(x,y,slp[nt,:,:],clevs,cmap=pylab.cm.RdBu_r,animated=True) # plot wind vectors on lat/lon grid. # rotate wind vectors to map projection coordinates. #urot,vrot = m.rotate_vector(u[nt,:,:],v[nt,:,:],lons,lats) - # plot wind vectors over map. + # plot wind vectors over mapylab. #Q = m.quiver(x,y,urot,vrot,scale=500) # plot wind vectors on projection grid (looks better). # first, shift grid so it goes from -180 to 180 (instead of 0 to 360 - # in longitude). Otherwise, interpolation is messed up. + # in longitude). Otherwise, interpolation is messed upylab. ugrid,newlons = shiftgrid(180.,u[nt,:,:],longitudes,start=False) vgrid,newlons = shiftgrid(180.,v[nt,:,:],longitudes,start=False) # transform vectors to projection grid. urot,vrot,xx,yy = m.transform_vector(ugrid,vgrid,newlons,latitudes,51,51,returnxy=True,masked=True) - # plot wind vectors over map. + # plot wind vectors over mapylab. Q = m.quiver(xx,yy,urot,vrot,scale=500) # make quiver key. - qk = p.quiverkey(Q, 0.1, 0.1, 20, '20 m/s', labelpos='W') + qk = pylab.quiverkey(Q, 0.1, 0.1, 20, '20 m/s', labelpos='W') # draw coastlines, parallels, meridians, title. m.drawcoastlines(linewidth=1.5) m.drawparallels(parallels) m.drawmeridians(meridians) - p.title('SLP and Wind Vectors '+date) + pylab.title('SLP and Wind Vectors '+date) if nt == 0: # plot colorbar on a separate axes (only for first frame) - cax = p.axes([l+w-0.05, b, 0.03, h]) # setup colorbar axes + cax = pylab.axes([l+w-0.05, b, 0.03, h]) # setup colorbar axes fig.colorbar(CS,drawedges=True, cax=cax) # draw colorbar cax.text(0.0,-0.05,'mb') - p.axes(ax) # reset current axes - p.draw() # draw the plot + pylab.axes(ax) # reset current axes + pylab.draw() # draw the plot # save first and last frame n1 times # (so gif animation pauses at beginning and end) if nframe == 0 or nt == slp.shape[0]-1: for n in range(n1): - p.savefig('anim%03i'%nframe+'.png') + pylab.savefig('anim%03i'%nframe+'.png') nframe = nframe + 1 else: - p.savefig('anim%03i'%nframe+'.png') + pylab.savefig('anim%03i'%nframe+'.png') nframe = nframe + 1 ax.clear() # clear the axes for the next plot. Modified: trunk/toolkits/basemap/examples/warpimage.py =================================================================== --- trunk/toolkits/basemap/examples/warpimage.py 2007年11月30日 12:58:57 UTC (rev 4518) +++ trunk/toolkits/basemap/examples/warpimage.py 2007年11月30日 14:36:43 UTC (rev 4519) @@ -1,6 +1,7 @@ import pylab as P +import numpy from matplotlib.toolkits.basemap import Basemap -from matplotlib.numerix import ma +from numpy import ma from matplotlib.image import pil_to_array from PIL import Image @@ -10,13 +11,13 @@ # read in jpeg image to rgba array of normalized floats. pilImage = Image.open('land_shallow_topo_2048.jpg') rgba = pil_to_array(pilImage) -rgba = rgba.astype(P.Float32)/255. # convert to normalized floats. +rgba = rgba.astype(numpy.float32)/255. # convert to normalized floats. # define lat/lon grid that image spans (projection='cyl'). nlons = rgba.shape[1]; nlats = rgba.shape[0] delta = 360./float(nlons) -lons = P.arange(-180.+0.5*delta,180.,delta) -lats = P.arange(-90.+0.5*delta,90.,delta) +lons = numpy.arange(-180.+0.5*delta,180.,delta) +lats = numpy.arange(-90.+0.5*delta,90.,delta) # create new figure fig=P.figure() @@ -27,8 +28,8 @@ # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines. -m.drawmeridians(P.arange(-180,180,60),labels=[0,0,0,1],color='0.5') -m.drawparallels(P.arange(-90,90,30),labels=[1,0,0,0],color='0.5') +m.drawmeridians(numpy.arange(-180,180,60),labels=[0,0,0,1],color='0.5') +m.drawparallels(numpy.arange(-90,90,30),labels=[1,0,0,0],color='0.5') P.title("Blue Marble image - native 'cyl' projection",fontsize=12) print 'plot cylindrical map (no warping needed) ...' @@ -38,9 +39,9 @@ m = Basemap(projection='ortho',lat_0=40,lon_0=40,resolution='l') # transform to nx x ny regularly spaced native projection grid # nx and ny chosen to have roughly the same horizontal res as original image. -dx = 2.*P.pi*m.rmajor/float(nlons) +dx = 2.*numpy.pi*m.rmajor/float(nlons) nx = int((m.xmax-m.xmin)/dx)+1; ny = int((m.ymax-m.ymin)/dx)+1 -rgba_warped = ma.zeros((ny,nx,4),P.Float64) +rgba_warped = ma.zeros((ny,nx,4),numpy.float64) # interpolate rgba values from proj='cyl' (geographic coords) to 'lcc' # values outside of projection limb will be masked. for k in range(4): @@ -52,8 +53,8 @@ # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines every 30 degrees. -m.drawmeridians(P.arange(0,360,30),color='0.5') -m.drawparallels(P.arange(-90,90,30),color='0.5') +m.drawmeridians(numpy.arange(0,360,30),color='0.5') +m.drawparallels(numpy.arange(-90,90,30),color='0.5') P.title("Blue Marble image warped from 'cyl' to 'ortho' projection",fontsize=12) print 'warp to orthographic map ...' @@ -67,7 +68,7 @@ # nx and ny chosen to have roughly the same horizontal res as original image. dx = 2.*P.pi*m.rmajor/float(nlons) nx = int((m.xmax-m.xmin)/dx)+1; ny = int((m.ymax-m.ymin)/dx)+1 -rgba_warped = P.zeros((ny,nx,4),P.Float64) +rgba_warped = numpy.zeros((ny,nx,4),numpy.float64) # interpolate rgba values from proj='cyl' (geographic coords) to 'lcc' for k in range(4): rgba_warped[:,:,k] = m.transform_scalar(rgba[:,:,k],lons,lats,nx,ny) @@ -77,9 +78,9 @@ m.drawcoastlines(linewidth=0.5,color='0.5') # draw parallels and meridians. # label on left, right and bottom of map. -parallels = P.arange(0.,80,20.) +parallels = numpy.arange(0.,80,20.) m.drawparallels(parallels,labels=[1,1,0,1],color='0.5') -meridians = P.arange(10.,360.,30.) +meridians = numpy.arange(10.,360.,30.) m.drawmeridians(meridians,labels=[1,1,0,1],color='0.5') P.title("Blue Marble image warped from 'cyl' to 'lcc' projection",fontsize=12) print 'warp to lambert conformal map ...' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4518 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4518&view=rev Author: jswhit Date: 2007年11月30日 04:58:57 -0800 (2007年11月30日) Log Message: ----------- docstring improvements. Modified Paths: -------------- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007年11月30日 04:09:48 UTC (rev 4517) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007年11月30日 12:58:57 UTC (rev 4518) @@ -1,3 +1,17 @@ +""" +Module for plotting data on maps with matplotlib. + +Contains the Basemap class (which does most of the +heavy lifting), and the following functions: + +NetCDFFile: Read local and remote NetCDF datasets. + +interp: bilinear interpolation between rectilinear grids. + +shiftgrid: shifts global lat/lon grids east or west. + +addcyclic: Add cyclic (wraparound) point in longitude. +""" from matplotlib import rcParams from matplotlib import __version__ as _matplotlib_version # check to make sure matplotlib is not too old. @@ -87,6 +101,10 @@ _Basemap_init_doc = """ create a Basemap instance. + This sets up a basemap with specified map projection. + and creates the coastline data structures in native map projection + coordinates. + arguments: projection - map projection. Supported projections are: @@ -195,6 +213,39 @@ latitude circle boundinglat is tangent to the edge of the map at lon_0. satellite_height - height of satellite (in m) above equator - only relevant for geostationary projections ('geos'). + + Here are the most commonly used class methods (see the docstring + for each for more details): + + To draw a graticule grid (labelled latitude and longitude lines) + use the drawparallels and drawmeridians methods. + + To draw coastline, rivers and political boundaries, use the + the drawcontinents, drawrivers, drawcountries and drawstates methods. + + To fill the continents and inland lakes, use the fillcontinents method. + + To draw the boundary of the map projection region, and fill the + interior a certain color, use the drawmapboundary method. + + The contour, contourf, pcolor, pcolormesh, plot, scatter + quiver and imshow methods use the corresponding matplotlib axes + methods to draw on the map. + + The transform_scalar method can be used to interpolate regular + lat/lon grids of scalar data to native map projection grids. + + The transform_vector method can be used to interpolate and rotate + regular lat/lon grids of vector data to native map projection grids. + + The rotate_vector method rotates a vector field from lat/lon + coordinates into map projections coordinates, without doing any + interpolation. + + The readshapefile method can be used to read in data from ESRI + shapefiles. + + The drawgreatcircle method draws great circles on the map. """ % locals() # unsupported projection error message. @@ -216,11 +267,9 @@ class Basemap(object): """ - Set up a basemap with specified map projection. - Doesn't actually draw anything, but sets up the map projection class and - creates the coastline, lake river and political boundary data - structures in native map projection coordinates. - Uses a pyrex interface to C-code from proj.4 (http://proj.maptools.org). + Class for plotting data on map projections with matplotlib. + See __init__ docstring for details on how to create a class + instance for a given map projection. Useful instance variables: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4517 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4517&view=rev Author: cmoad Date: 2007年11月29日 20:09:48 -0800 (2007年11月29日) Log Message: ----------- added setup.cfg.template Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/MANIFEST.in Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007年11月30日 04:00:16 UTC (rev 4516) +++ trunk/matplotlib/CHANGELOG 2007年11月30日 04:09:48 UTC (rev 4517) @@ -1,5 +1,5 @@ =============================================================== -2007年11月27日 Released 0.91.1 at revision 4516 +2007年11月27日 Released 0.91.1 at revision 4517 =わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ 2007年11月27日 Released 0.91.0 at revision 4478 Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2007年11月30日 04:00:16 UTC (rev 4516) +++ trunk/matplotlib/MANIFEST.in 2007年11月30日 04:09:48 UTC (rev 4517) @@ -1,7 +1,7 @@ include API_CHANGES CHANGELOG KNOWN_BUGS INSTALL NUMARRAY_ISSUES include INTERACTIVE TODO include Makefile MANIFEST.in MANIFEST -include matplotlibrc.template matplotlibrc +include matplotlibrc.template matplotlibrc setup.cfg.template include __init__.py setupext.py setup.py setupegg.py makeswig.py include examples/data/* include lib/matplotlib/toolkits This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4516 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4516&view=rev Author: cmoad Date: 2007年11月29日 20:00:16 -0800 (2007年11月29日) Log Message: ----------- ttconv missing from MANFEST Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/MANIFEST.in Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007年11月30日 03:42:35 UTC (rev 4515) +++ trunk/matplotlib/CHANGELOG 2007年11月30日 04:00:16 UTC (rev 4516) @@ -1,5 +1,5 @@ =============================================================== -2007年11月27日 Released 0.91.1 at revision 4515 +2007年11月27日 Released 0.91.1 at revision 4516 =わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ 2007年11月27日 Released 0.91.0 at revision 4478 Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2007年11月30日 03:42:35 UTC (rev 4515) +++ trunk/matplotlib/MANIFEST.in 2007年11月30日 04:00:16 UTC (rev 4516) @@ -16,3 +16,4 @@ recursive-include agg23 * recursive-include lib * recursive-include swig * +recursive-include ttconv *.cpp *.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4515 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4515&view=rev Author: cmoad Date: 2007年11月29日 19:42:35 -0800 (2007年11月29日) Log Message: ----------- CXX/WrapPython.h missing from MANIFEST Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/MANIFEST.in Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007年11月30日 02:47:06 UTC (rev 4514) +++ trunk/matplotlib/CHANGELOG 2007年11月30日 03:42:35 UTC (rev 4515) @@ -1,5 +1,5 @@ =============================================================== -2007年11月27日 Released 0.91.1 at revision 4514 +2007年11月27日 Released 0.91.1 at revision 4515 =わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ 2007年11月27日 Released 0.91.0 at revision 4478 Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2007年11月30日 02:47:06 UTC (rev 4514) +++ trunk/matplotlib/MANIFEST.in 2007年11月30日 03:42:35 UTC (rev 4515) @@ -12,7 +12,7 @@ recursive-include examples README *.py prune examples/_tmp_* recursive-include src *.cpp *.c *.h -recursive-include CXX *.cxx *.hxx *.c +recursive-include CXX *.cxx *.hxx *.c *.h recursive-include agg23 * recursive-include lib * recursive-include swig * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4514 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4514&view=rev Author: cmoad Date: 2007年11月29日 18:47:06 -0800 (2007年11月29日) Log Message: ----------- minor rev bump Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/__init__.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007年11月30日 02:41:01 UTC (rev 4513) +++ trunk/matplotlib/CHANGELOG 2007年11月30日 02:47:06 UTC (rev 4514) @@ -1,5 +1,5 @@ =============================================================== -2007年11月27日 Released 0.91.1 at revision 4513 +2007年11月27日 Released 0.91.1 at revision 4514 =わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ 2007年11月27日 Released 0.91.0 at revision 4478 Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2007年11月30日 02:41:01 UTC (rev 4513) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2007年11月30日 02:47:06 UTC (rev 4514) @@ -55,7 +55,7 @@ """ from __future__ import generators -__version__ = '0.91.0' +__version__ = '0.91.1' __revision__ = '$Revision$' __date__ = '$Date$' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4513 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4513&view=rev Author: cmoad Date: 2007年11月29日 18:41:01 -0800 (2007年11月29日) Log Message: ----------- minor rev bump Modified Paths: -------------- trunk/matplotlib/CHANGELOG Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007年11月30日 02:40:30 UTC (rev 4512) +++ trunk/matplotlib/CHANGELOG 2007年11月30日 02:41:01 UTC (rev 4513) @@ -1,4 +1,7 @@ =============================================================== +2007年11月27日 Released 0.91.1 at revision 4513 +たす +たす=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ=わ 2007年11月27日 Released 0.91.0 at revision 4478 2007年11月13日 All backends now support writing to a file-like object, not This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4512 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4512&view=rev Author: cmoad Date: 2007年11月29日 18:40:30 -0800 (2007年11月29日) Log Message: ----------- minor rev bump Modified Paths: -------------- trunk/matplotlib/API_CHANGES Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2007年11月30日 02:19:04 UTC (rev 4511) +++ trunk/matplotlib/API_CHANGES 2007年11月30日 02:40:30 UTC (rev 4512) @@ -1,3 +1,5 @@ +0.91.1 Released + 0.91.0 Released Changed cbook.is_file_like to cbook.is_writable_file_like and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4511 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4511&view=rev Author: jdh2358 Date: 2007年11月29日 18:19:04 -0800 (2007年11月29日) Log Message: ----------- more updates to credits Modified Paths: -------------- trunk/htdocs/credits.html.template Modified: trunk/htdocs/credits.html.template =================================================================== --- trunk/htdocs/credits.html.template 2007年11月30日 00:11:06 UTC (rev 4510) +++ trunk/htdocs/credits.html.template 2007年11月30日 02:19:04 UTC (rev 4511) @@ -2,10 +2,13 @@ <h2>Credits</h2> -matplotlib was written by John Hunter<p> +matplotlib was written by John Hunter and is now developed and +maintained by a number of +<a href=http://www.ohloh.net/projects/531/analyses/latest/contributors>active +developers</a><p> <h4>Special thanks to those who have made valuable contributions -(roughly in order of contribution by date)</h4> +(roughly in order of first contribution by date)</h4> <ul> @@ -29,24 +32,27 @@ <li>David Moore wrote the paint backend</li> - <li>Todd Miller contributed the TkAgg backend and the numerix + <li>Todd Miller aupported by <a + href=http://www.stsci.edu/>STScI</a> contributed the TkAgg backend and the numerix module, which allows matplotlib to work with either numeric or numarray. He also ported image support to the postscript backend, with much pain and suffering.</li> - <li>Paul Barrett overhauled font management to provide an improved, + <li>Paul Barrett supported by <a + href=http://www.stsci.edu/>STScI</a> overhauled font management to provide an improved, free-standing, platform independent font manager with a WC3 compliant font finder and cache mechanism and ported truetype and mathtext to PS</li> - <li>Perry Greenfield overhauled and modernized the goals and - priorities page, implemented an improved colormap framework, and has - provided many suggestions and a lot of insight to the overall design - and organization of matplotlib.</li> + <li>Perry Greenfield supported by + <a href=http://www.stsci.edu/>STScI</a> overhauled and modernized + the goals and priorities page, implemented an improved colormap + framework, and has provided many suggestions and a lot of insight to + the overall design and organization of matplotlib.</li> - <li>Jared Wahlstrand wrote the SVG backend</li> + <li>Jared Wahlstrand wrote the initial SVG backend</li> - <li>Steve Chaplin is the GTK maintainer and wrote the Cairo and + <li>Steve Chaplin served as the GTK maintainer and wrote the Cairo and GTKCairo backends</li> <li>Jim Benson provided the patch to handle vertical mathttext</li> @@ -57,11 +63,13 @@ ticking</li> <li>Darren Dale did the work to do mathtext exponential labeling for - log plots, added improved support for scalar formatting, and did a - lot of work to clean up the <a - href=psfrag" rel=nofollow>http://www.ctan.org/tex-archive/help/Catalogue/entries/psfrag.html?action=/tex-archive/macros/latex/contrib/supported/psfrag/>psfrag</a> - LaTeX output. He wrote the site.cfg and matplotlib.conf - configuration support</li> + log plots, added improved support for scalar formatting, and did the + lions share of the + <a href=psfrag" rel=nofollow>http://www.ctan.org/tex-archive/help/Catalogue/entries/psfrag.html?action=/tex-archive/macros/latex/contrib/supported/psfrag/>psfrag</a> + LaTeX support for postscript. He has made substantial contributions + to extending and maintaining the PS and Qt backends, and wrote the + site.cfg and matplotlib.conf build and runtime configuration + support</li> <li>Paul Mcguire provided the pyparsing module on which mathtext relies, and made a number of optimizations to the matplotlib @@ -77,33 +85,37 @@ <li>Andrew Dalke of Dalke Scientific Software contributed the strftime formatting code to handle years earlier than 1900</li> - <li>Jochen Voss maintains the PS backend and has contributed several - bugfixes.</li> + <li>Jochen Voss served as PS backend maintainer and has contributed + several bugfixes.</li> - <li>Nadia Dencheva of <a - href=http://www.stsci.edu/>STSci</a> provided the contouring and + <li>Nadia Dencheva supported by <a + href=http://www.stsci.edu/>STScI</a> provided the contouring and contour labeling code</li> <li>Baptiste Carvello provided the key ideas in a patch for proper shared axes support that underlies ganged plots and multiscale plots</li> - <li>Jeffrey Whittaker wrote the <a href=toolkits.html>basemap</a> - tookit</li> + <li>Jeffrey Whittaker at + <a href=http://www.boulder.noaa.gov/>NOAA</a> wrote + the <a href=toolkits.html>basemap</a> tookit</li> - <li>Sigve Tjoraand Ted Drain and colleagues at the + <li>Sigve Tjoraand, Ted Drain and colleagues at the <a href=http://www.jpl.nasa.gov>JPL</a> collaborated on the QtAgg backend</li> - <li>Eric Firing added the contourf function and general contour - refactoring and a patch for masked array support for line plots</li> + <li>Eric Firing has contributed significantly to contouring, masked + array, pcolor, image and quiver support, in addition to ongoing + support and enhancements in performance, design and code quality in + most aspects of matplotlib.</li> <li>Daishi Harada added support for "Dashed Text". See <a href=examples/dashpointlabel.py>dashpointlabel.py</a> and <a href=matplotlib.text.html#TextWithDash>TextWithDash</a></li> - <li>Nicolas Young added support for byte images to imshow, which - are more efficient in CPU and memory.</li> + <li>Nicolas Young added support for byte images to imshow, which are + more efficient in CPU and memory, and added support for irregularly + sampled images.</li> <li>The <a href=http://brainvisa.info>brainvisa</a> Orsay team and Fernando Perez added Qt support to <a @@ -115,10 +127,12 @@ <li>Jouni K. Seppaenen wrote the PDF backend</li> - <li>Michael Droettboom wrote the enhanced mathtext support, -implementing Knuth's box layout algorithms, and is responsible for -numerous bug-fixes, better font support, and feature enhancements -across the matplotlib backends</li> + <li>Michael Droettboom supported by + <a href=http://www.stsci.edu/>STScI</a> wrote the enhanced mathtext + support, implementing Knuth's box layout algorithms, saving to + file-like objects across backends, and is responsible for numerous + bug-fixes, much better font and unicode support, and feature and + performance enhancements across the matplotlib code base. </li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4510 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4510&view=rev Author: jswhit Date: 2007年11月29日 16:11:06 -0800 (2007年11月29日) Log Message: ----------- missing file Added Paths: ----------- trunk/toolkits/basemap/lib/dap/util/ordereddict.py Removed Paths: ------------- trunk/toolkits/basemap/lib/dap/util/ordereddict.py Deleted: trunk/toolkits/basemap/lib/dap/util/ordereddict.py =================================================================== --- trunk/toolkits/basemap/lib/dap/util/ordereddict.py 2007年11月29日 22:19:26 UTC (rev 4509) +++ trunk/toolkits/basemap/lib/dap/util/ordereddict.py 2007年11月30日 00:11:06 UTC (rev 4510) @@ -1,126 +0,0 @@ -"""Ordered dictionary. - -This is a dictionary class that preserves the order in which the keys are -stored. This is necessary to build Structures and Sequences that follow the -requested variable order. -""" - -__author__ = "Roberto De Almeida <ro...@py...>" - -import copy - - -class odict(dict): - - """Ordered dictionary.""" - - def __init__(self, odict=None): - self._keys = [] - self._dict = {} - - if odict is not None: - self.update(odict) - - def __iter__(self): - return iter(self._keys[:]) - - def __setitem__(self, key, item): - self._dict.__setitem__(key, item) - if key not in self._keys: self._keys.append(key) - - def __getitem__(self, key): - return self._dict.__getitem__(key) - - def __delitem__(self, key): - self._dict.__delitem__(key) - self._keys.remove(key) - - def keys(self): - return self._keys[:] - - def items(self): - return [(key, self._dict.__getitem__(key)) for key in self._keys] - - def values(self): - return [self._dict.__getitem__(key) for key in self._keys] - - def iterkeys(self): - for key in self._keys: yield key - - def iteritems(self): - for key in self._keys: yield (key, self._dict.__getitem__(key)) - - def itervalues(self): - for key in self._keys: yield self._dict.__getitem__(key) - - def clear(self): - self._dict.clear() - self._keys = [] - - def copy(self): - new = odict(self) - return new - - def update(self, odict): - for k, v in odict.items(): - self.__setitem__(k, v) - - def setdefault(self, key, d=None): - if key not in self._keys: self._keys.append(key) - return self._dict.setdefault(key, d) - - def get(self, key, d=None): - if key in self._keys: return self._dict.__getitem__(key) - else: return d - - def has_key(self, key): - return self._dict.has_key(key) - - def popitem(self): - try: key = self._keys[-1] - except IndexError: raise KeyError('dictionary is empty') - - self._keys.remove(key) - return self._dict.pop(key) - - def pop(self, key, d=None): - value = self._dict.pop(key, d) - - try: self._keys.remove(key) - except ValueError: pass - - return value - - def fromkeys(keys, d=None): - new = odict() - for key in keys: new.__setitem__(key, d) - return new - - def __contains__(self, key): - return self._dict.has_key(key) - - def __len__(self): - return self._dict.__len__() - - def __repr__(self): - return '{%s}' % ', '.join(['%s: %s' % (k.__repr__(), v.__repr__()) for (k, v) in self.items()]) - - def __str__(self): - return '{%s}' % ', '.join(['%s: %s' % (k.__repr__(), v.__repr__()) for (k, v) in self.items()]) - - def __copy__(self): - return self.copy() - - def __deepcopy__(self, memo=None, _nil=[]): - new = odict() - for k, v in self.items(): - new.__setitem__(k, copy.deepcopy(v)) - return new - - -def _test(): - import doctest - doctest.testmod() - -if __name__ == "__main__": - _test() Added: trunk/toolkits/basemap/lib/dap/util/ordereddict.py =================================================================== --- trunk/toolkits/basemap/lib/dap/util/ordereddict.py (rev 0) +++ trunk/toolkits/basemap/lib/dap/util/ordereddict.py 2007年11月30日 00:11:06 UTC (rev 4510) @@ -0,0 +1,126 @@ +"""Ordered dictionary. + +This is a dictionary class that preserves the order in which the keys are +stored. This is necessary to build Structures and Sequences that follow the +requested variable order. +""" + +__author__ = "Roberto De Almeida <ro...@py...>" + +import copy + + +class odict(dict): + + """Ordered dictionary.""" + + def __init__(self, odict=None): + self._keys = [] + self._dict = {} + + if odict is not None: + self.update(odict) + + def __iter__(self): + return iter(self._keys[:]) + + def __setitem__(self, key, item): + self._dict.__setitem__(key, item) + if key not in self._keys: self._keys.append(key) + + def __getitem__(self, key): + return self._dict.__getitem__(key) + + def __delitem__(self, key): + self._dict.__delitem__(key) + self._keys.remove(key) + + def keys(self): + return self._keys[:] + + def items(self): + return [(key, self._dict.__getitem__(key)) for key in self._keys] + + def values(self): + return [self._dict.__getitem__(key) for key in self._keys] + + def iterkeys(self): + for key in self._keys: yield key + + def iteritems(self): + for key in self._keys: yield (key, self._dict.__getitem__(key)) + + def itervalues(self): + for key in self._keys: yield self._dict.__getitem__(key) + + def clear(self): + self._dict.clear() + self._keys = [] + + def copy(self): + new = odict(self) + return new + + def update(self, odict): + for k, v in odict.items(): + self.__setitem__(k, v) + + def setdefault(self, key, d=None): + if key not in self._keys: self._keys.append(key) + return self._dict.setdefault(key, d) + + def get(self, key, d=None): + if key in self._keys: return self._dict.__getitem__(key) + else: return d + + def has_key(self, key): + return self._dict.has_key(key) + + def popitem(self): + try: key = self._keys[-1] + except IndexError: raise KeyError('dictionary is empty') + + self._keys.remove(key) + return self._dict.pop(key) + + def pop(self, key, d=None): + value = self._dict.pop(key, d) + + try: self._keys.remove(key) + except ValueError: pass + + return value + + def fromkeys(keys, d=None): + new = odict() + for key in keys: new.__setitem__(key, d) + return new + + def __contains__(self, key): + return self._dict.has_key(key) + + def __len__(self): + return self._dict.__len__() + + def __repr__(self): + return '{%s}' % ', '.join(['%s: %s' % (k.__repr__(), v.__repr__()) for (k, v) in self.items()]) + + def __str__(self): + return '{%s}' % ', '.join(['%s: %s' % (k.__repr__(), v.__repr__()) for (k, v) in self.items()]) + + def __copy__(self): + return self.copy() + + def __deepcopy__(self, memo=None, _nil=[]): + new = odict() + for k, v in self.items(): + new.__setitem__(k, copy.deepcopy(v)) + return new + + +def _test(): + import doctest + doctest.testmod() + +if __name__ == "__main__": + _test() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.