SF.net SVN: matplotlib: [5722] trunk/toolkits/basemap/doc/users

2008-07-09 Thread jswhit
Revision: 5722
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5722&view=rev
Author:   jswhit
Date: 2008-07-09 05:04:06 -0700 (Wed, 09 Jul 2008)

Log Message:
---
added 3 projections to examples

Modified Paths:
--
trunk/toolkits/basemap/doc/users/mapsetup.rst

Added Paths:
---
trunk/toolkits/basemap/doc/users/cyl.rst
trunk/toolkits/basemap/doc/users/figures/cyl.py
trunk/toolkits/basemap/doc/users/figures/merc.py
trunk/toolkits/basemap/doc/users/figures/mill.py
trunk/toolkits/basemap/doc/users/merc.rst
trunk/toolkits/basemap/doc/users/mill.rst

Added: trunk/toolkits/basemap/doc/users/cyl.rst
===
--- trunk/toolkits/basemap/doc/users/cyl.rst(rev 0)
+++ trunk/toolkits/basemap/doc/users/cyl.rst2008-07-09 12:04:06 UTC (rev 
5722)
@@ -0,0 +1,10 @@
+.. _cyl:
+
+Equidistant Cylindrical Projection
+==
+
+The simplest projection, just displays the world in latitude/longitude 
coordinates. 
+
+.. literalinclude:: figures/cyl.py
+
+.. image:: figures/cyl.png

Added: trunk/toolkits/basemap/doc/users/figures/cyl.py
===
--- trunk/toolkits/basemap/doc/users/figures/cyl.py 
(rev 0)
+++ trunk/toolkits/basemap/doc/users/figures/cyl.py 2008-07-09 12:04:06 UTC 
(rev 5722)
@@ -0,0 +1,17 @@
+from mpl_toolkits.basemap import Basemap
+import numpy as np
+import matplotlib.pyplot as plt
+# llcrnrlat,llcrnrlon,urcrnrlat,urcrnrlon
+# are the lat/lon values of the lower left and upper right corners
+# of the map.
+# resolution = 'c' means use crude resolution coastlines.
+m = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,\
+llcrnrlon=-180,urcrnrlon=180,resolution='c')
+m.drawcoastlines()
+m.fillcontinents(color='coral',lake_color='aqua')
+# draw parallels and meridians.
+m.drawparallels(np.arange(-90.,91.,30.))
+m.drawmeridians(np.arange(-180.,181.,60.))
+m.drawmapboundary(fill_color='aqua') 
+plt.title("Equidistant Cylindrical Projection")
+plt.savefig('cyl.png')

Added: trunk/toolkits/basemap/doc/users/figures/merc.py
===
--- trunk/toolkits/basemap/doc/users/figures/merc.py
(rev 0)
+++ trunk/toolkits/basemap/doc/users/figures/merc.py2008-07-09 12:04:06 UTC 
(rev 5722)
@@ -0,0 +1,18 @@
+from mpl_toolkits.basemap import Basemap
+import numpy as np
+import matplotlib.pyplot as plt
+# llcrnrlat,llcrnrlon,urcrnrlat,urcrnrlon
+# are the lat/lon values of the lower left and upper right corners
+# of the map.
+# lat_ts is the latitude of true scale.
+# resolution = 'c' means use crude resolution coastlines.
+m = Basemap(projection='merc',llcrnrlat=-80,urcrnrlat=80,\
+llcrnrlon=-180,urcrnrlon=180,lat_ts=20,resolution='c')
+m.drawcoastlines()
+m.fillcontinents(color='coral',lake_color='aqua')
+# draw parallels and meridians.
+m.drawparallels(np.arange(-90.,91.,30.))
+m.drawmeridians(np.arange(-180.,181.,60.))
+m.drawmapboundary(fill_color='aqua') 
+plt.title("Mercator Projection")
+plt.savefig('merc.png')

Added: trunk/toolkits/basemap/doc/users/figures/mill.py
===
--- trunk/toolkits/basemap/doc/users/figures/mill.py
(rev 0)
+++ trunk/toolkits/basemap/doc/users/figures/mill.py2008-07-09 12:04:06 UTC 
(rev 5722)
@@ -0,0 +1,17 @@
+from mpl_toolkits.basemap import Basemap
+import numpy as np
+import matplotlib.pyplot as plt
+# llcrnrlat,llcrnrlon,urcrnrlat,urcrnrlon
+# are the lat/lon values of the lower left and upper right corners
+# of the map.
+# resolution = 'c' means use crude resolution coastlines.
+m = Basemap(projection='mill',llcrnrlat=-90,urcrnrlat=90,\
+llcrnrlon=-180,urcrnrlon=180,resolution='c')
+m.drawcoastlines()
+m.fillcontinents(color='coral',lake_color='aqua')
+# draw parallels and meridians.
+m.drawparallels(np.arange(-90.,91.,30.))
+m.drawmeridians(np.arange(-180.,181.,60.))
+m.drawmapboundary(fill_color='aqua') 
+plt.title("Miller Cylindrical Projection")
+plt.savefig('mill.png')

Modified: trunk/toolkits/basemap/doc/users/mapsetup.rst
===
--- trunk/toolkits/basemap/doc/users/mapsetup.rst   2008-07-08 14:55:33 UTC 
(rev 5721)
+++ trunk/toolkits/basemap/doc/users/mapsetup.rst   2008-07-09 12:04:06 UTC 
(rev 5722)
@@ -24,7 +24,11 @@
 are longer, more descriptive names.  The class variable ``projection_params``
 is a dictionary that provides a list of parameters that can be used to
 define the properties of each projection.  Following are examples that 
-illustrate how to set up each of the supported projections.
+illustrate how to set up each of the supported projections. Note that
+many map projection possess one of two desirable 

SF.net SVN: matplotlib: [5723] branches/v0_91_maint

2008-07-09 Thread mdboom
Revision: 5723
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5723&view=rev
Author:   mdboom
Date: 2008-07-09 06:33:13 -0700 (Wed, 09 Jul 2008)

Log Message:
---
Improve mathtext radical rendering

Modified Paths:
--
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/mathtext.py

Modified: branches/v0_91_maint/CHANGELOG
===
--- branches/v0_91_maint/CHANGELOG  2008-07-09 12:04:06 UTC (rev 5722)
+++ branches/v0_91_maint/CHANGELOG  2008-07-09 13:33:13 UTC (rev 5723)
@@ -1,3 +1,5 @@
+2008-07-09 Improve mathtext radical rendering - MGD
+
 2008-07-08 Improve mathtext superscript placement - MGD
 
 2008-06-30 Removed Qt4 NavigationToolbar2.destroy -- it appears to

Modified: branches/v0_91_maint/lib/matplotlib/mathtext.py
===
--- branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-07-09 12:04:06 UTC 
(rev 5722)
+++ branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-07-09 13:33:13 UTC 
(rev 5723)
@@ -190,7 +190,7 @@
 
 from matplotlib.afm import AFM
 from matplotlib.cbook import enumerate, iterable, Bunch, 
get_realpath_and_stat, \
-is_string_like
+is_string_like, maxdict
 from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT, 
LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING
 from matplotlib.font_manager import findfont, FontProperties
 from matplotlib._mathtext_data import latex_to_bakoma, \
@@ -318,7 +318,13 @@
 self.image, ox, oy - info.metrics.ymax, info.glyph)
 
 def render_rect_filled(self, x1, y1, x2, y2):
-self.image.draw_rect_filled(x1, y1, x2, max(y2 - 1, y1))
+height = max(int(y2 - y1) - 1, 0)
+if height == 0:
+center = (y2 + y1) / 2.0
+y = int(center - (height + 1) / 2.0)
+else:
+y = int(y1)
+self.image.draw_rect_filled(int(x1), y, ceil(x2), y + height)
 
 def get_results(self, box):
 return (self.ox,
@@ -477,8 +483,8 @@
 to be destroyed."""
 self.used_characters = None
 
-def get_kern(self, font1, sym1, fontsize1,
- font2, sym2, fontsize2, dpi):
+def get_kern(self, font1, fontclass1, sym1, fontsize1,
+ font2, fontclass2, sym2, fontsize2, dpi):
 """
 Get the kerning distance for font between sym1 and sym2.
 
@@ -666,7 +672,8 @@
 info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi)
 font = info1.font
 return font.get_kerning(info1.num, info2.num, KERNING_DEFAULT) / 
64.0
-return 0.0
+return Fonts.get_kern(self, font1, fontclass1, sym1, fontsize1,
+  font2, fontclass2, sym2, fontsize2, dpi)
 
 class BakomaFonts(TruetypeFonts):
 """
@@ -1121,7 +1128,8 @@
 font = info1.font
 return (font.get_kern_dist(info1.glyph, info2.glyph)
 * 0.001 * fontsize1)
-return 0.0
+return Fonts.get_kern(self, font1, fontclass1, sym1, fontsize1,
+  font2, fontclass2, sym2, fontsize2, dpi)
 
 def get_xheight(self, font, fontsize, dpi):
 cached_font = self._get_font(font)
@@ -1431,6 +1439,19 @@
 new_children.append(kern)
 self.children = new_children
 
+# This is a failed experiment to fake cross-font kerning.
+# def get_kerning(self, next):
+# if len(self.children) >= 2 and isinstance(self.children[-2], Char):
+# if isinstance(next, Char):
+# print "CASE A"
+# return self.children[-2].get_kerning(next)
+# elif isinstance(next, Hlist) and len(next.children) and 
isinstance(next.children[0], Char):
+# print "CASE B"
+# result = self.children[-2].get_kerning(next.children[0])
+# print result
+# return result
+# return 0.0
+
 def hpack(self, w=0., m='additional'):
 """The main duty of hpack is to compute the dimensions of the
 resulting boxes, and to adjust the glue if one of those dimensions is
@@ -1442,8 +1463,8 @@
 w: specifies a width
 m: is either 'exactly' or 'additional'.
 
-Thus, hpack(w, exactly) produces a box whose width is exactly w, while
-hpack (w, additional ) yields a box whose width is the natural width
+Thus, hpack(w, 'exactly') produces a box whose width is exactly w, 
while
+hpack (w, 'additional') yields a box whose width is the natural width
 plus w.  The default values produce a box with the natural width.
 node644, node649"""
 # I don't know why these get reset in TeX.  Shift_amount is pretty
@@ -1506,8 +1527,8 @@
 m: is either 'exactly' or 'additional'.
 l: a maximum height
 
-Thus, vpack(h, exactly) produces a box whose width is exactly w, 

SF.net SVN: matplotlib: [5724] trunk/matplotlib

2008-07-09 Thread mdboom
Revision: 5724
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5724&view=rev
Author:   mdboom
Date: 2008-07-09 06:39:36 -0700 (Wed, 09 Jul 2008)

Log Message:
---
Merged revisions 5721-5723 via svnmerge from 
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint


r5723 | mdboom | 2008-07-09 09:33:13 -0400 (Wed, 09 Jul 2008) | 2 lines

Improve mathtext radical rendering



Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/mathtext.py

Property Changed:

trunk/matplotlib/


Property changes on: trunk/matplotlib
___
Name: svnmerge-integrated
   - /branches/v0_91_maint:1-5720
   + /branches/v0_91_maint:1-5723

Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG  2008-07-09 13:33:13 UTC (rev 5723)
+++ trunk/matplotlib/CHANGELOG  2008-07-09 13:39:36 UTC (rev 5724)
@@ -1,3 +1,5 @@
+2008-07-09 Improve mathtext radical rendering - MGD
+
 2008-07-08 Improve mathtext superscript placement - MGD
 
 2008-07-07 Fix custom scales in pcolormesh (thanks Matthew Turk) - MGD

Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-07-09 13:33:13 UTC (rev 
5723)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-07-09 13:39:36 UTC (rev 
5724)
@@ -322,7 +322,13 @@
 self.image, ox, oy - info.metrics.ymax, info.glyph)
 
 def render_rect_filled(self, x1, y1, x2, y2):
-self.image.draw_rect_filled(x1, y1, x2, max(y2 - 1, y1))
+height = max(int(y2 - y1) - 1, 0)
+if height == 0:
+center = (y2 + y1) / 2.0
+y = int(center - (height + 1) / 2.0)
+else:
+y = int(y1)
+self.image.draw_rect_filled(int(x1), y, ceil(x2), y + height)
 
 def get_results(self, box):
 return (self.ox,
@@ -481,8 +487,8 @@
 to be destroyed."""
 self.used_characters = None
 
-def get_kern(self, font1, sym1, fontsize1,
- font2, sym2, fontsize2, dpi):
+def get_kern(self, font1, fontclass1, sym1, fontsize1,
+ font2, fontclass2, sym2, fontsize2, dpi):
 """
 Get the kerning distance for font between sym1 and sym2.
 
@@ -670,7 +676,8 @@
 info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi)
 font = info1.font
 return font.get_kerning(info1.num, info2.num, KERNING_DEFAULT) / 
64.0
-return 0.0
+return Fonts.get_kern(self, font1, fontclass1, sym1, fontsize1,
+  font2, fontclass2, sym2, fontsize2, dpi)
 
 class BakomaFonts(TruetypeFonts):
 """
@@ -1123,7 +1130,8 @@
 font = info1.font
 return (font.get_kern_dist(info1.glyph, info2.glyph)
 * 0.001 * fontsize1)
-return 0.0
+return Fonts.get_kern(self, font1, fontclass1, sym1, fontsize1,
+  font2, fontclass2, sym2, fontsize2, dpi)
 
 def get_xheight(self, font, fontsize, dpi):
 cached_font = self._get_font(font)
@@ -1433,6 +1441,19 @@
 new_children.append(kern)
 self.children = new_children
 
+# This is a failed experiment to fake cross-font kerning.
+# def get_kerning(self, next):
+# if len(self.children) >= 2 and isinstance(self.children[-2], Char):
+# if isinstance(next, Char):
+# print "CASE A"
+# return self.children[-2].get_kerning(next)
+# elif isinstance(next, Hlist) and len(next.children) and 
isinstance(next.children[0], Char):
+# print "CASE B"
+# result = self.children[-2].get_kerning(next.children[0])
+# print result
+# return result
+# return 0.0
+
 def hpack(self, w=0., m='additional'):
 """The main duty of hpack is to compute the dimensions of the
 resulting boxes, and to adjust the glue if one of those dimensions is
@@ -2593,13 +2614,6 @@
 thickness = state.font_output.get_underline_thickness(
 state.font, state.fontsize, state.dpi)
 
-if root is None:
-root = Box(0., 0., 0.)
-else:
-root = Hlist([Char(x, state) for x in root])
-root.shrink()
-root.shrink()
-
 # Determine the height of the body, and add a little extra to
 # the height so it doesn't seem cramped
 height = body.height - body.shift_amount + thickness * 5.0
@@ -2616,10 +2630,18 @@
Fill(),
padded_body])
 # Stretch the glue between the hrule and the body
-rightside.vpack(height + 1.0, depth, 'exactly')
+rightside.vpack(heig

SF.net SVN: matplotlib: [5725] trunk/matplotlib/doc/users/mathtext.rst

2008-07-09 Thread mdboom
Revision: 5725
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5725&view=rev
Author:   mdboom
Date: 2008-07-09 07:48:16 -0700 (Wed, 09 Jul 2008)

Log Message:
---
Correct typo.

Modified Paths:
--
trunk/matplotlib/doc/users/mathtext.rst

Modified: trunk/matplotlib/doc/users/mathtext.rst
===
--- trunk/matplotlib/doc/users/mathtext.rst 2008-07-09 13:39:36 UTC (rev 
5724)
+++ trunk/matplotlib/doc/users/mathtext.rst 2008-07-09 14:48:16 UTC (rev 
5725)
@@ -260,7 +260,7 @@
 == =
 
 Care should be taken when putting accents on lower-case i's and j's.
-Note that in the following ``\mathi`` is used to avoid the extra dot
+Note that in the following ``\imath`` is used to avoid the extra dot
 over the i::
 
 r"$\hat i\ \ \hat \imath$"


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [5726] trunk/py4science/classes/0808_scipy_agenda. txt

2008-07-09 Thread mdboom
Revision: 5726
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5726&view=rev
Author:   mdboom
Date: 2008-07-09 09:16:50 -0700 (Wed, 09 Jul 2008)

Log Message:
---
Added preliminary matplotlib outline

Modified Paths:
--
trunk/py4science/classes/0808_scipy_agenda.txt

Modified: trunk/py4science/classes/0808_scipy_agenda.txt
===
--- trunk/py4science/classes/0808_scipy_agenda.txt  2008-07-09 14:48:16 UTC 
(rev 5725)
+++ trunk/py4science/classes/0808_scipy_agenda.txt  2008-07-09 16:16:50 UTC 
(rev 5726)
@@ -6,6 +6,7 @@
 ..
 1  Introduction and resources
 2  Day 1
+3  Day 2
 ..
 
 Introduction and resources
@@ -92,3 +93,25 @@
 
 
 * Python packages and modules, the very basics: __init__.py and $PYTHONPATH.
+
+Day 2
+=
+
+* basic plotting with matplotlib
+  * basic line/scatter plotting
+* customizing colors, styles
+* legend
+  * backends - what they are and pros/cons of each
+  * matplotlibrc
+  * math text
+
+... probably some of Perry's content here ...
+
+* advanced plotting with matplotlib
+  * the object-oriented API
+  * text annotations
+  * tour of advanced plot types
+* polar plots
+* histograms
+* images
+  * color maps


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [5727] trunk/matplotlib

2008-07-09 Thread mdboom
Revision: 5727
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5727&view=rev
Author:   mdboom
Date: 2008-07-09 12:30:22 -0700 (Wed, 09 Jul 2008)

Log Message:
---
Fix rectangular polar axes patch.

Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/projections/geo.py
trunk/matplotlib/lib/matplotlib/projections/polar.py

Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG  2008-07-09 16:16:50 UTC (rev 5726)
+++ trunk/matplotlib/CHANGELOG  2008-07-09 19:30:22 UTC (rev 5727)
@@ -1,3 +1,5 @@
+2008-07-09 Fix rectangular axes patch on polar plots bug - MGD
+
 2008-07-09 Improve mathtext radical rendering - MGD
 
 2008-07-08 Improve mathtext superscript placement - MGD

Modified: trunk/matplotlib/lib/matplotlib/projections/geo.py
===
--- trunk/matplotlib/lib/matplotlib/projections/geo.py  2008-07-09 16:16:50 UTC 
(rev 5726)
+++ trunk/matplotlib/lib/matplotlib/projections/geo.py  2008-07-09 19:30:22 UTC 
(rev 5727)
@@ -127,7 +127,7 @@
 def get_yaxis_text2_transform(self, pad):
 return self._yaxis_text2_transform, 'center', 'left'
 
-def get_axes_patch(self):
+def _gen_axes_patch(self):
 return Circle((0.5, 0.5), 0.5)
 
 def set_yscale(self, *args, **kwargs):

Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py
===
--- trunk/matplotlib/lib/matplotlib/projections/polar.py2008-07-09 
16:16:50 UTC (rev 5726)
+++ trunk/matplotlib/lib/matplotlib/projections/polar.py2008-07-09 
19:30:22 UTC (rev 5727)
@@ -261,7 +261,7 @@
 def get_yaxis_text2_transform(self, pad):
 return self._yaxis_text2_transform, 'center', 'center'
 
-def get_axes_patch(self):
+def _gen_axes_patch(self):
 return Circle((0.5, 0.5), 0.5)
 
 def set_rmax(self, rmax):


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [5728] trunk/matplotlib/examples/api/ custom_projection_example.py

2008-07-09 Thread mdboom
Revision: 5728
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5728&view=rev
Author:   mdboom
Date: 2008-07-09 12:34:43 -0700 (Wed, 09 Jul 2008)

Log Message:
---
Fix rectangular polar axes patch (continued...)

Modified Paths:
--
trunk/matplotlib/examples/api/custom_projection_example.py

Modified: trunk/matplotlib/examples/api/custom_projection_example.py
===
--- trunk/matplotlib/examples/api/custom_projection_example.py  2008-07-09 
19:30:22 UTC (rev 5727)
+++ trunk/matplotlib/examples/api/custom_projection_example.py  2008-07-09 
19:34:43 UTC (rev 5728)
@@ -217,7 +217,7 @@
 """
 return self._yaxis_text2_transform, 'center', 'left'
 
-def get_axes_patch(self):
+def _gen_axes_patch(self):
 """
 Override this method to define the shape that is used for the
 background of the plot.  It should be a subclass of Patch.


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins