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

2007-12-10 Thread mdboom
Revision: 4679
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4679&view=rev
Author:   mdboom
Date: 2007-12-10 06:50:40 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Use an 8-spline approximation of an ellipse instead of a 4-spline one.

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
trunk/matplotlib/lib/matplotlib/patches.py

Added Paths:
---
trunk/matplotlib/unit/ellipse_large.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py  2007-12-09 
00:48:27 UTC (rev 4678)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py  2007-12-10 
14:50:40 UTC (rev 4679)
@@ -1644,11 +1644,15 @@
 } bind def""",
 """/unitcircle {
 newpath
--1. 0. moveto
--1.0 0.552284749831 -0.552284749831 1.0 0.0 1.0 curveto
-0.552284749831 1.0 1.0 0.552284749831 1.0 0.0 curveto
-1.0 -0.552284749831 0.552284749831 -1.0 0.0 -1.0 curveto
--0.552284749831 -1.0 -1.0 -0.552284749831 -1.0 0.0 curveto
+0. -1. moveto
+0.2652031 -1.0 0.519579870785 -0.894633691588 0.707106781187 -0.707106781187 
curveto
+0.894633691588 -0.519579870785 1.0 -0.2652031 1.0 0.0 curveto
+1.0 0.2652031 0.894633691588 0.519579870785 0.707106781187 0.707106781187 
curveto
+0.519579870785 0.894633691588 0.2652031 1.0 0.0 1.0 curveto
+-0.2652031 1.0 -0.519579870785 0.894633691588 -0.707106781187 0.707106781187 
curveto
+-0.894633691588 0.519579870785 -1.0 0.2652031 -1.0 0.0 curveto
+-1.0 -0.2652031 -0.894633691588 -0.519579870785 -0.707106781187 
-0.707106781187 curveto
+-0.519579870785 -0.894633691588 -0.2652031 -1.0 0.0 -1.0 curveto
 closepath
 } bind def""",
 

Modified: trunk/matplotlib/lib/matplotlib/patches.py
===
--- trunk/matplotlib/lib/matplotlib/patches.py  2007-12-09 00:48:27 UTC (rev 
4678)
+++ trunk/matplotlib/lib/matplotlib/patches.py  2007-12-10 14:50:40 UTC (rev 
4679)
@@ -201,7 +201,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)
 
@@ -764,32 +764,46 @@
 """
 A scale-free ellipse
 """
-offset = 4.0 * (npy.sqrt(2) - 1) / 3.0
+MAGIC = 0.2652031
+SQRT2 = npy.sqrt(0.5)
+MAGIC45 = npy.sqrt((MAGIC*MAGIC) / 2.0)
 
-circle = npy.array([
-[-1.0, 0.0],
+circle = npy.array(
+[[0.0, -1.0],
 
-[-1.0, offset],
-[-offset, 1.0],
-[0.0, 1.0],
+ [MAGIC, -1.0],
+ [SQRT2-MAGIC45, -SQRT2-MAGIC45],
+ [SQRT2, -SQRT2],
 
-[offset, 1.0],
-[1.0, offset],
-[1.0, 0.0],
+ [SQRT2+MAGIC45, -SQRT2+MAGIC45],
+ [1.0, -MAGIC],
+ [1.0, 0.0],
 
-[1.0, -offset],
-[offset, -1.0],
-[0.0, -1.0],
+ [1.0, MAGIC],
+ [SQRT2+MAGIC45, SQRT2-MAGIC45],
+ [SQRT2, SQRT2],
 
-[-offset, -1.0],
-[-1.0, -offset],
-[-1.0, 0.0],
+ [SQRT2-MAGIC45, SQRT2+MAGIC45],
+ [MAGIC, 1.0],
+ [0.0, 1.0],
 
-[-1.0, 0.0]
-],
-   npy.float_)
+ [-MAGIC, 1.0],
+ [-SQRT2+MAGIC45, SQRT2+MAGIC45],
+ [-SQRT2, SQRT2],
 
-
+ [-SQRT2-MAGIC45, SQRT2-MAGIC45],
+ [-1.0, MAGIC],
+ [-1.0, 0.0],
+
+ [-1.0, -MAGIC],
+ [-SQRT2-MAGIC45, -SQRT2+MAGIC45],
+ [-SQRT2, -SQRT2],
+
+ [-SQRT2+MAGIC45, -SQRT2-MAGIC45],
+ [-MAGIC, -1.0],
+ [0.0, -1.0]],
+npy.float_)
+
 def __str__(self):
 return 
"Ellipse(%d,%d;%dx%d)"%(self.center[0],self.center[1],self.width,self.height)
 
@@ -823,9 +837,9 @@
 width, height = self.width, self.height
 
 xcenter = self.convert_xunits(xcenter)
-width = self.convert_xunits(width)
+width = self.convert_xunits(width)
 ycenter = self.convert_yunits(ycenter)
-height = self.convert_xunits(height)
+height = self.convert_xunits(height)
 
 
 
@@ -871,8 +885,8 @@
 mpl.verbose.report('patches.Ellipse renderer does not support path 
drawing; falling back on vertex approximation for nonlinear transformation')
 renderer.draw_polygon(gc, rgbFace, self.get_verts())
 return
-
 
+
 x, y = self.center
 x = self.convert_xunits(x)
 y = self.convert_yunits(y)
@@ -887,14 +901,14 @@
 
 
 
-
+
 S = npy.array([
 [w, 0, 0],
 [0, h, 0],
 [0, 0, 1]])
 
 
-
+
 # rotate by theta
 R = npy.array([
 [npy.cos(theta),  -npy.sin(theta), 0],
@@ -903,8 +917,8 @@
 
 # transform unit circle into ellipse
 E = n

SF.net SVN: matplotlib: [4680] branches/transforms/lib/matplotlib/path.py

2007-12-10 Thread mdboom
Revision: 4680
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4680&view=rev
Author:   mdboom
Date: 2007-12-10 06:59:49 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Use an 8-spline approximation of an ellipse instead of a 4-spline one.

Modified Paths:
--
branches/transforms/lib/matplotlib/path.py

Modified: branches/transforms/lib/matplotlib/path.py
===
--- branches/transforms/lib/matplotlib/path.py  2007-12-10 14:50:40 UTC (rev 
4679)
+++ branches/transforms/lib/matplotlib/path.py  2007-12-10 14:59:49 UTC (rev 
4680)
@@ -15,8 +15,6 @@
 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
-
 class Path(object):
 """
 Path represents a series of possibly disconnected, possibly
@@ -350,33 +348,58 @@
 def unit_circle(cls):
 """
 Returns a Path of the unit circle.  The circle is approximated
-using cubic Bezier curves.
+using cubic Bezier curves.  This uses 8 splines around the
+circle using the approach presented here:
+
+Lancaster, Don.  Approximating a Circle or an Ellipse Using Four
+Bezier Cubic Splines.
+
+http://www.tinaja.com/glib/ellipse4.pdf
 """
if cls._unit_circle is None:
-offset = KAPPA
+MAGIC = 0.2652031
+SQRT2 = npy.sqrt(0.5)
+MAGIC45 = npy.sqrt((MAGIC*MAGIC) / 2.0)
+
vertices = npy.array(
-   [[-1.0, 0.0],
+   [[0.0, -1.0],
 
-[-1.0, offset],
-[-offset, 1.0],
-[0.0, 1.0],
+[MAGIC, -1.0],
+[SQRT2-MAGIC45, -SQRT2-MAGIC45],
+[SQRT2, -SQRT2],
 
-[offset, 1.0],
-[1.0, offset],
-[1.0, 0.0],
+[SQRT2+MAGIC45, -SQRT2+MAGIC45],
+[1.0, -MAGIC],
+ [1.0, 0.0],
 
-[1.0, -offset],
-[offset, -1.0],
-[0.0, -1.0],
+ [1.0, MAGIC],
+ [SQRT2+MAGIC45, SQRT2-MAGIC45],
+ [SQRT2, SQRT2],
 
-[-offset, -1.0],
-[-1.0, -offset],
-[-1.0, 0.0],
+ [SQRT2-MAGIC45, SQRT2+MAGIC45],
+ [MAGIC, 1.0],
+ [0.0, 1.0],
 
- [-1.0, 0.0]],
+ [-MAGIC, 1.0],
+ [-SQRT2+MAGIC45, SQRT2+MAGIC45],
+ [-SQRT2, SQRT2],
+
+ [-SQRT2-MAGIC45, SQRT2-MAGIC45],
+ [-1.0, MAGIC],
+ [-1.0, 0.0],
+
+ [-1.0, -MAGIC],
+ [-SQRT2-MAGIC45, -SQRT2+MAGIC45],
+ [-SQRT2, -SQRT2],
+
+ [-SQRT2+MAGIC45, -SQRT2-MAGIC45],
+ [-MAGIC, -1.0],
+ [0.0, -1.0],
+
+ [0.0, -1.0]],
 npy.float_)
 
-codes = cls.CURVE4 * npy.ones(14)
+codes = cls.CURVE4 * npy.ones(26)
codes[0] = cls.MOVETO
 codes[-1] = cls.CLOSEPOLY
 


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4681] branches/transforms/lib/matplotlib/backends/ backend_mixed.py

2007-12-10 Thread mdboom
Revision: 4681
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4681&view=rev
Author:   mdboom
Date: 2007-12-10 07:00:03 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Bugfix.

Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_mixed.py

Modified: branches/transforms/lib/matplotlib/backends/backend_mixed.py
===
--- branches/transforms/lib/matplotlib/backends/backend_mixed.py
2007-12-10 14:59:49 UTC (rev 4680)
+++ branches/transforms/lib/matplotlib/backends/backend_mixed.py
2007-12-10 15:00:03 UTC (rev 4681)
@@ -30,7 +30,7 @@
 self._raster_renderer_class = raster_renderer_class
 self._width = width
 self._height = height
-self._dpi = dpi
+self.dpi = dpi
 
 assert not vector_renderer.option_image_nocomposite()
 self._vector_renderer = vector_renderer
@@ -55,7 +55,7 @@
 setattr(self, method, getattr(renderer, method))
 renderer.start_rasterizing = self.start_rasterizing
 renderer.stop_rasterizing = self.stop_rasterizing
-
+
 def start_rasterizing(self):
 """
 Enter "raster" mode.  All subsequent drawing commands (until
@@ -70,7 +70,7 @@
 self._width*self._dpi, self._height*self._dpi, self._dpi)
 self._set_current_renderer(self._raster_renderer)
 self._rasterizing = True
-
+
 def stop_rasterizing(self):
 """
 Exit "raster" mode.  All of the drawing that was done since


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4682] branches/transforms/src/_backend_agg.cpp

2007-12-10 Thread mdboom
Revision: 4682
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4682&view=rev
Author:   mdboom
Date: 2007-12-10 07:03:33 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Draw aligned lines more often than before.

Modified Paths:
--
branches/transforms/src/_backend_agg.cpp

Modified: branches/transforms/src/_backend_agg.cpp
===
--- branches/transforms/src/_backend_agg.cpp2007-12-10 15:00:03 UTC (rev 
4681)
+++ branches/transforms/src/_backend_agg.cpp2007-12-10 15:03:33 UTC (rev 
4682)
@@ -352,8 +352,6 @@
   // pixels
   double x0, y0, x1, y1;
   unsigned code;
-  if (path.total_vertices() > 5)
-return false;
 
   code = path.vertex(&x0, &y0);
   trans.transform(&x0, &y0);


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4683] branches/transforms/lib/matplotlib/path.py

2007-12-10 Thread mdboom
Revision: 4683
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4683&view=rev
Author:   mdboom
Date: 2007-12-10 07:21:58 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Fix variable name.

Modified Paths:
--
branches/transforms/lib/matplotlib/path.py

Modified: branches/transforms/lib/matplotlib/path.py
===
--- branches/transforms/lib/matplotlib/path.py  2007-12-10 15:03:33 UTC (rev 
4682)
+++ branches/transforms/lib/matplotlib/path.py  2007-12-10 15:21:58 UTC (rev 
4683)
@@ -358,41 +358,41 @@
 """
if cls._unit_circle is None:
 MAGIC = 0.2652031
-SQRT2 = npy.sqrt(0.5)
+SQRTHALF = npy.sqrt(0.5)
 MAGIC45 = npy.sqrt((MAGIC*MAGIC) / 2.0)
 
vertices = npy.array(
[[0.0, -1.0],
 
 [MAGIC, -1.0],
-[SQRT2-MAGIC45, -SQRT2-MAGIC45],
-[SQRT2, -SQRT2],
+[SQRTHALF-MAGIC45, -SQRTHALF-MAGIC45],
+[SQRTHALF, -SQRTHALF],
 
-[SQRT2+MAGIC45, -SQRT2+MAGIC45],
+[SQRTHALF+MAGIC45, -SQRTHALF+MAGIC45],
 [1.0, -MAGIC],
  [1.0, 0.0],
 
  [1.0, MAGIC],
- [SQRT2+MAGIC45, SQRT2-MAGIC45],
- [SQRT2, SQRT2],
+ [SQRTHALF+MAGIC45, SQRTHALF-MAGIC45],
+ [SQRTHALF, SQRTHALF],
 
- [SQRT2-MAGIC45, SQRT2+MAGIC45],
+ [SQRTHALF-MAGIC45, SQRTHALF+MAGIC45],
  [MAGIC, 1.0],
  [0.0, 1.0],
 
  [-MAGIC, 1.0],
- [-SQRT2+MAGIC45, SQRT2+MAGIC45],
- [-SQRT2, SQRT2],
+ [-SQRTHALF+MAGIC45, SQRTHALF+MAGIC45],
+ [-SQRTHALF, SQRTHALF],
 
- [-SQRT2-MAGIC45, SQRT2-MAGIC45],
+ [-SQRTHALF-MAGIC45, SQRTHALF-MAGIC45],
  [-1.0, MAGIC],
  [-1.0, 0.0],
 
  [-1.0, -MAGIC],
- [-SQRT2-MAGIC45, -SQRT2+MAGIC45],
- [-SQRT2, -SQRT2],
+ [-SQRTHALF-MAGIC45, -SQRTHALF+MAGIC45],
+ [-SQRTHALF, -SQRTHALF],
 
- [-SQRT2+MAGIC45, -SQRT2-MAGIC45],
+ [-SQRTHALF+MAGIC45, -SQRTHALF-MAGIC45],
  [-MAGIC, -1.0],
  [0.0, -1.0],
 


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4684] trunk/matplotlib/lib/matplotlib/patches.py

2007-12-10 Thread mdboom
Revision: 4684
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4684&view=rev
Author:   mdboom
Date: 2007-12-10 07:23:08 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Fix variable name.

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/patches.py

Modified: trunk/matplotlib/lib/matplotlib/patches.py
===
--- trunk/matplotlib/lib/matplotlib/patches.py  2007-12-10 15:21:58 UTC (rev 
4683)
+++ trunk/matplotlib/lib/matplotlib/patches.py  2007-12-10 15:23:08 UTC (rev 
4684)
@@ -765,41 +765,41 @@
 A scale-free ellipse
 """
 MAGIC = 0.2652031
-SQRT2 = npy.sqrt(0.5)
+SQRTHALF = npy.sqrt(0.5)
 MAGIC45 = npy.sqrt((MAGIC*MAGIC) / 2.0)
 
 circle = npy.array(
 [[0.0, -1.0],
 
  [MAGIC, -1.0],
- [SQRT2-MAGIC45, -SQRT2-MAGIC45],
- [SQRT2, -SQRT2],
+ [SQRTHALF-MAGIC45, -SQRTHALF-MAGIC45],
+ [SQRTHALF, -SQRTHALF],
 
- [SQRT2+MAGIC45, -SQRT2+MAGIC45],
+ [SQRTHALF+MAGIC45, -SQRTHALF+MAGIC45],
  [1.0, -MAGIC],
  [1.0, 0.0],
 
  [1.0, MAGIC],
- [SQRT2+MAGIC45, SQRT2-MAGIC45],
- [SQRT2, SQRT2],
+ [SQRTHALF+MAGIC45, SQRTHALF-MAGIC45],
+ [SQRTHALF, SQRTHALF],
 
- [SQRT2-MAGIC45, SQRT2+MAGIC45],
+ [SQRTHALF-MAGIC45, SQRTHALF+MAGIC45],
  [MAGIC, 1.0],
  [0.0, 1.0],
 
  [-MAGIC, 1.0],
- [-SQRT2+MAGIC45, SQRT2+MAGIC45],
- [-SQRT2, SQRT2],
+ [-SQRTHALF+MAGIC45, SQRTHALF+MAGIC45],
+ [-SQRTHALF, SQRTHALF],
 
- [-SQRT2-MAGIC45, SQRT2-MAGIC45],
+ [-SQRTHALF-MAGIC45, SQRTHALF-MAGIC45],
  [-1.0, MAGIC],
  [-1.0, 0.0],
 
  [-1.0, -MAGIC],
- [-SQRT2-MAGIC45, -SQRT2+MAGIC45],
- [-SQRT2, -SQRT2],
+ [-SQRTHALF-MAGIC45, -SQRTHALF+MAGIC45],
+ [-SQRTHALF, -SQRTHALF],
 
- [-SQRT2+MAGIC45, -SQRT2-MAGIC45],
+ [-SQRTHALF+MAGIC45, -SQRTHALF-MAGIC45],
  [-MAGIC, -1.0],
  [0.0, -1.0]],
 npy.float_)


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4685] trunk/matplotlib/lib/matplotlib/font_manager .py

2007-12-10 Thread mdboom
Revision: 4685
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4685&view=rev
Author:   mdboom
Date: 2007-12-10 07:34:29 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Fix syntax for pre-Python 2.5

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/font_manager.py

Modified: trunk/matplotlib/lib/matplotlib/font_manager.py
===
--- trunk/matplotlib/lib/matplotlib/font_manager.py 2007-12-10 15:23:08 UTC 
(rev 4684)
+++ trunk/matplotlib/lib/matplotlib/font_manager.py 2007-12-10 15:34:29 UTC 
(rev 4685)
@@ -109,9 +109,10 @@
 else:
 user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders)
 try:
-return _winreg.QueryValueEx(user, 'Fonts')[0]
-except OSError:
-pass # Fall through to default
+try:
+return _winreg.QueryValueEx(user, 'Fonts')[0]
+except OSError:
+pass # Fall through to default
 finally:
 _winreg.CloseKey(user)
 return os.path.join(os.environ['WINDIR'], 'Fonts')


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


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

2007-12-10 Thread mdboom
Revision: 4686
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4686&view=rev
Author:   mdboom
Date: 2007-12-10 08:15:30 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Support draw_path (importantly for ellipses) in Pdf, Svg and Cairo
backends.
Fix SVG text rendering bug.

Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
trunk/matplotlib/lib/matplotlib/backends/backend_svg.py

Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG  2007-12-10 15:34:29 UTC (rev 4685)
+++ trunk/matplotlib/CHANGELOG  2007-12-10 16:15:30 UTC (rev 4686)
@@ -1,3 +1,9 @@
+2007-12-10 Fix SVG text rendering bug.
+
+2007-12-10 Increase accuracy of circle and ellipse drawing by using an 8-piece
+   bezier approximation, rather than a 4-piece one.  Fix PDF, SVG and
+   Cairo backends so they can draw paths (meaning ellipses as well).
+
 2007-12-07 Issue a warning when drawing an image on a non-linear axis. - MGD
 
 2007-12-06 let widgets.Cursor initialize to the lower x and y bounds

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py   2007-12-10 
15:34:29 UTC (rev 4685)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py   2007-12-10 
16:15:30 UTC (rev 4686)
@@ -34,6 +34,7 @@
 backend_version = cairo.version
 del _version_required
 
+from matplotlib import agg
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
  FigureManagerBase, FigureCanvasBase
 from matplotlib.cbookimport enumerate, izip, is_string_like
@@ -124,7 +125,35 @@
 
 #_.ctx.restore() # revert to the default attributes
 
+def draw_path(self, gc, rgbFace, path):
+ctx = gc.ctx
+ctx.new_path()
 
+while 1:
+code, xp, yp = path.vertex()
+yp = self.height - yp
+
+if code == agg.path_cmd_stop:
+ctx.close_path()
+break
+elif code == agg.path_cmd_move_to:
+ctx.move_to(xp, yp)
+elif code == agg.path_cmd_line_to:
+ctx.line_to(xp, yp)
+elif code == agg.path_cmd_curve3:
+_, xp1, yp1 = path.vertex()
+yp1 = self.height - yp1
+ctx.curve_to(xp, yp, xp, yp, xp1, yp1)
+elif code == agg.path_cmd_curve4:
+_, xp1, yp1 = path.vertex()
+yp1 = self.height - yp1
+_, xp2, yp2 = path.vertex()
+yp2 = self.height - yp2
+ctx.curve_to(xp, yp, xp1, yp1, xp2, yp2)
+elif code == agg.path_cmd_end_poly:
+ctx.close_path()
+self._fill_and_stroke(ctx, rgbFace)
+
 def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2,
  rotation):
 if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
@@ -307,11 +336,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,
@@ -332,7 +361,7 @@
 
 ctx.restore()
 
-
+
 def flipy(self):
 if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
 return True
@@ -494,7 +523,7 @@
 
 self.figure.draw (renderer)
 surface.write_to_png (fobj)
-
+
 def print_pdf(self, fobj, *args, **kwargs):
 return self._save(fobj, 'pdf', *args, **kwargs)
 
@@ -506,10 +535,10 @@
 
 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')

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-12-10 
15:34:29 UTC (rev 4685)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-12-10 
16:15:30 UTC (rev 4686)
@@ -1249,6 +1249,36 @@
 
 self.file.output(self.gc.close_and_paint())
 
+def draw_path(self, gc, rgbFace, path):
+self.check_gc(gc, rgbFace)
+
+cmds = []
+
+while 1:
+code, xp, yp = path.vertex()
+
+if code == agg.path_cmd_stop:
+cmds.append(Op.closepath)
+break
+   

SF.net SVN: matplotlib: [4687] trunk/toolkits/basemap/Changelog

2007-12-10 Thread jswhit
Revision: 4687
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4687&view=rev
Author:   jswhit
Date: 2007-12-10 08:17:16 -0800 (Mon, 10 Dec 2007)

Log Message:
---
setup.py now looks for GEOS lib in a few standard places
if GEOS_DIR not set.

Modified Paths:
--
trunk/toolkits/basemap/Changelog

Modified: trunk/toolkits/basemap/Changelog
===
--- trunk/toolkits/basemap/Changelog2007-12-10 16:15:30 UTC (rev 4686)
+++ trunk/toolkits/basemap/Changelog2007-12-10 16:17:16 UTC (rev 4687)
@@ -1,4 +1,9 @@
 version 0.9.9 (not yet released)
+   * setup.py now looks for GEOS library in a few standard
+ places (/usr/local, /opt, $HOME, /sw) if the GEOS_DIR
+ environment variable not set.  This is a workaround for a
+ new Leopard 'feature' (sudo does not inherit enviroment
+ variables).
* added support for reading Point and MultiPoint shapes
  from ESRI shapefiles.
* now automatically draws figure if running in


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4688] branches/transforms

2007-12-10 Thread mdboom
Revision: 4688
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4688&view=rev
Author:   mdboom
Date: 2007-12-10 08:17:42 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Merged revisions 4669-4682 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib


  r4670 | mdboom | 2007-12-07 14:18:58 -0500 (Fri, 07 Dec 2007) | 2 lines
  
  Updating CHANGELOG.

  r4679 | mdboom | 2007-12-10 09:50:40 -0500 (Mon, 10 Dec 2007) | 2 lines
  
  Use an 8-spline approximation of an ellipse instead of a 4-spline one.


Modified Paths:
--
branches/transforms/CHANGELOG
branches/transforms/lib/matplotlib/backends/backend_ps.py
branches/transforms/lib/matplotlib/patches.py

Added Paths:
---
branches/transforms/unit/ellipse_large.py

Property Changed:

branches/transforms/


Property changes on: branches/transforms
___
Name: svnmerge-integrated
   - /trunk/matplotlib:1-4668
   + /trunk/matplotlib:1-4682

Modified: branches/transforms/CHANGELOG
===
--- branches/transforms/CHANGELOG   2007-12-10 16:17:16 UTC (rev 4687)
+++ branches/transforms/CHANGELOG   2007-12-10 16:17:42 UTC (rev 4688)
@@ -1,3 +1,5 @@
+2007-12-07 Issue a warning when drawing an image on a non-linear axis. - MGD
+
 2007-12-06 let widgets.Cursor initialize to the lower x and y bounds
rather than 0,0, which can cause havoc for dates and other
transforms - DSD
@@ -6,6 +8,10 @@
 
 2007-12-06 fixed a bug in rcsetup, see bug 1845057 - DSD
 
+2007-12-05 Fix how fonts are cached to avoid loading the same one multiple 
times.
+   (This was a regression since 0.90 caused by the refactoring of
+   font_manager.py) - MGD
+
 ===
 2007-11-27 Released 0.91.1 at revision 4517
 

Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py
===
--- branches/transforms/lib/matplotlib/backends/backend_ps.py   2007-12-10 
16:17:16 UTC (rev 4687)
+++ branches/transforms/lib/matplotlib/backends/backend_ps.py   2007-12-10 
16:17:42 UTC (rev 4688)
@@ -1430,4 +1430,31 @@
   clip
   newpath
 } bind def""",
+<<< .working
+===
+# angle1 angle2 rx ry x y  *ellipse*  -
+"""/ellipse {
+  newpath
+  matrix currentmatrix 7 1 roll
+  translate
+  scale
+  0 0 1 5 3 roll arc
+  setmatrix
+  closepath
+} bind def""",
+"""/unitcircle {
+newpath
+0. -1. moveto
+0.2652031 -1.0 0.519579870785 -0.894633691588 0.707106781187 -0.707106781187 
curveto
+0.894633691588 -0.519579870785 1.0 -0.2652031 1.0 0.0 curveto
+1.0 0.2652031 0.894633691588 0.519579870785 0.707106781187 0.707106781187 
curveto
+0.519579870785 0.894633691588 0.2652031 1.0 0.0 1.0 curveto
+-0.2652031 1.0 -0.519579870785 0.894633691588 -0.707106781187 0.707106781187 
curveto
+-0.894633691588 0.519579870785 -1.0 0.2652031 -1.0 0.0 curveto
+-1.0 -0.2652031 -0.894633691588 -0.519579870785 -0.707106781187 
-0.707106781187 curveto
+-0.519579870785 -0.894633691588 -0.2652031 -1.0 0.0 -1.0 curveto
+closepath
+} bind def""",
+
+>>> .merge-right.r4679
 ]

Modified: branches/transforms/lib/matplotlib/patches.py
===
--- branches/transforms/lib/matplotlib/patches.py   2007-12-10 16:17:16 UTC 
(rev 4687)
+++ branches/transforms/lib/matplotlib/patches.py   2007-12-10 16:17:42 UTC 
(rev 4688)
@@ -820,6 +820,49 @@
 """
 A scale-free ellipse
 """
+<<< .working
+===
+MAGIC = 0.2652031
+SQRT2 = npy.sqrt(0.5)
+MAGIC45 = npy.sqrt((MAGIC*MAGIC) / 2.0)
+
+circle = npy.array(
+[[0.0, -1.0],
+
+ [MAGIC, -1.0],
+ [SQRT2-MAGIC45, -SQRT2-MAGIC45],
+ [SQRT2, -SQRT2],
+
+ [SQRT2+MAGIC45, -SQRT2+MAGIC45],
+ [1.0, -MAGIC],
+ [1.0, 0.0],
+
+ [1.0, MAGIC],
+ [SQRT2+MAGIC45, SQRT2-MAGIC45],
+ [SQRT2, SQRT2],
+
+ [SQRT2-MAGIC45, SQRT2+MAGIC45],
+ [MAGIC, 1.0],
+ [0.0, 1.0],
+
+ [-MAGIC, 1.0],
+ [-SQRT2+MAGIC45, SQRT2+MAGIC45],
+ [-SQRT2, SQRT2],
+
+ [-SQRT2-MAGIC45, SQRT2-MAGIC45],
+ [-1.0, MAGIC],
+ [-1.0, 0.0],
+
+ [-1.0, -MAGIC],
+ [-SQRT2-MAGIC45, -SQRT2+MAGIC45],
+ [-SQRT2, -SQRT2],
+
+ [-SQRT2+MAGIC45, -SQRT2-MAGIC45],
+ [-MAGIC, -1.0],
+ [0.0, -1.0]],
+npy.float_)
+
+>>> .merge-right.r4679
 def __str__(self):
 return 
"Ellipse(%d,%d;%dx%d)"%(self.center[0],self.center[1],self.width,self.height)
 
@@ -855,10 +898,17 @@
 def get_patch_transform(self):
 return self._patch_transform
 
+<<< .working
 def contains(self,ev):
   

SF.net SVN: matplotlib: [4689] branches/transforms

2007-12-10 Thread mdboom
Revision: 4689
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4689&view=rev
Author:   mdboom
Date: 2007-12-10 08:21:36 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Merged revisions 4683-4688 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib


  r4684 | mdboom | 2007-12-10 10:23:08 -0500 (Mon, 10 Dec 2007) | 2 lines
  
  Fix variable name.

  r4685 | mdboom | 2007-12-10 10:34:29 -0500 (Mon, 10 Dec 2007) | 2 lines
  
  Fix syntax for pre-Python 2.5

  r4686 | mdboom | 2007-12-10 11:15:30 -0500 (Mon, 10 Dec 2007) | 4 lines
  
  Support draw_path (importantly for ellipses) in Pdf, Svg and Cairo
  backends.
  Fix SVG text rendering bug.


Modified Paths:
--
branches/transforms/CHANGELOG
branches/transforms/lib/matplotlib/backends/backend_cairo.py
branches/transforms/lib/matplotlib/backends/backend_pdf.py
branches/transforms/lib/matplotlib/backends/backend_svg.py
branches/transforms/lib/matplotlib/font_manager.py
branches/transforms/lib/matplotlib/patches.py

Property Changed:

branches/transforms/


Property changes on: branches/transforms
___
Name: svnmerge-integrated
   - /trunk/matplotlib:1-4682
   + /trunk/matplotlib:1-4688

Modified: branches/transforms/CHANGELOG
===
--- branches/transforms/CHANGELOG   2007-12-10 16:17:42 UTC (rev 4688)
+++ branches/transforms/CHANGELOG   2007-12-10 16:21:36 UTC (rev 4689)
@@ -1,3 +1,9 @@
+2007-12-10 Fix SVG text rendering bug.
+
+2007-12-10 Increase accuracy of circle and ellipse drawing by using an 8-piece
+   bezier approximation, rather than a 4-piece one.  Fix PDF, SVG and
+   Cairo backends so they can draw paths (meaning ellipses as well).
+
 2007-12-07 Issue a warning when drawing an image on a non-linear axis. - MGD
 
 2007-12-06 let widgets.Cursor initialize to the lower x and y bounds

Modified: branches/transforms/lib/matplotlib/backends/backend_cairo.py
===
--- branches/transforms/lib/matplotlib/backends/backend_cairo.py
2007-12-10 16:17:42 UTC (rev 4688)
+++ branches/transforms/lib/matplotlib/backends/backend_cairo.py
2007-12-10 16:21:36 UTC (rev 4689)
@@ -34,6 +34,7 @@
 backend_version = cairo.version
 del _version_required
 
+from matplotlib import agg
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
  FigureManagerBase, FigureCanvasBase
 from matplotlib.cbookimport enumerate, izip, is_string_like
@@ -117,6 +118,7 @@
 ctx.stroke()
 
 
+<<< .working
 [EMAIL PROTECTED]
 def convert_path(ctx, tpath):
 for points, code in tpath.iter_segments():
@@ -133,12 +135,48 @@
 elif code == Path.CLOSEPOLY:
 ctx.close_path()
 convert_path = staticmethod(convert_path)
+===
+def draw_path(self, gc, rgbFace, path):
+ctx = gc.ctx
+ctx.new_path()
+>>> .merge-right.r4686
 
+<<< .working
 
 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.")
 
+===
+while 1:
+code, xp, yp = path.vertex()
+yp = self.height - yp
+
+if code == agg.path_cmd_stop:
+ctx.close_path()
+break
+elif code == agg.path_cmd_move_to:
+ctx.move_to(xp, yp)
+elif code == agg.path_cmd_line_to:
+ctx.line_to(xp, yp)
+elif code == agg.path_cmd_curve3:
+_, xp1, yp1 = path.vertex()
+yp1 = self.height - yp1
+ctx.curve_to(xp, yp, xp, yp, xp1, yp1)
+elif code == agg.path_cmd_curve4:
+_, xp1, yp1 = path.vertex()
+yp1 = self.height - yp1
+_, xp2, yp2 = path.vertex()
+yp2 = self.height - yp2
+ctx.curve_to(xp, yp, xp1, yp1, xp2, yp2)
+elif code == agg.path_cmd_end_poly:
+ctx.close_path()
+self._fill_and_stroke(ctx, rgbFace)
+
+def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2,
+ rotation):
+if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
+>>> .merge-right.r4686
 ctx = gc.ctx
 transform = transform + \
 Affine2D().scale(1.0, -1.0).translate(0, self.height)

Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py  2007-12-10 
16:17:42 UTC (rev 4688)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py  2007-12-10 
16:21:36 

SF.net SVN: matplotlib: [4690] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/basemap.py

2007-12-10 Thread jswhit
Revision: 4690
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4690&view=rev
Author:   jswhit
Date: 2007-12-10 08:23:52 -0800 (Mon, 10 Dec 2007)

Log Message:
---
cleanup docstring

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-12-10 16:21:36 UTC (rev 4689)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py   
2007-12-10 16:23:52 UTC (rev 4690)
@@ -2912,9 +2912,9 @@
 
 times - numeric time values. Maximum resolution is 1 second.
 
-units - a string of the form ' since '
- describing the time units.  can be days, hours, minutes
- or seconds.   is the time origin. A valid choice
+units - a string of the form ' since '
+ describing the time units.  can be days, hours, minutes
+ or seconds.   is the time origin.  A valid choice
  would be units='hours since 1800-01-01 00:00:00 -6:00'.
 
 calendar - describes the calendar used in the time calculations. 
@@ -2922,7 +2922,8 @@
  (http://cf-pcmdi.llnl.gov/documents/cf-conventions/) are supported.
  Valid calendars 'standard', 'gregorian', 'proleptic_gregorian'
  'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'.
- Default is 'standard', which is a mixed Julian/Gregorian calendar.
+ Default is 'standard'/'gregorian', which is a mixed 
+ Julian/Gregorian calendar.
 
 Returns a datetime instance, or an array of datetime instances.
 
@@ -2931,11 +2932,8 @@
 calendar='proleptic_gregorian', or calendar = 'standard' or 'gregorian'
 and the date is after 1582-10-15). Otherwise, they are 'phony' datetime 
 objects which support some but not all the methods of 'real' python
-datetime objects.  This is because the python datetime module cannot
-the weird dates in some calendars (such as '360_day' and 'all_leap'
-which don't exist in any real world calendar. The datetime instances
-do not contain a time-zone offset, even if the specified units
-contains one.
+datetime objects.  The datetime instances do not contain
+a time-zone offset, even if the specified units contains one.
 """
 cdftime = netcdftime.utime(units,calendar=calendar)
 return cdftime.num2date(times)
@@ -2959,9 +2957,9 @@
 dates - A datetime object or a sequence of datetime objects.
  The datetime objects should not include a time-zone offset.
 
-units - a string of the form ' since '
- describing the time units.  can be days, hours, minutes
- or seconds.   is the time origin. A valid choice
+units - a string of the form ' since '
+ describing the time units.  can be days, hours, minutes
+ or seconds.   is the time origin.  A valid choice
  would be units='hours since 1800-01-01 00:00:00 -6:00'.
 
 calendar - describes the calendar used in the time calculations. 
@@ -2969,7 +2967,8 @@
  (http://cf-pcmdi.llnl.gov/documents/cf-conventions/) are supported.
  Valid calendars 'standard', 'gregorian', 'proleptic_gregorian'
  'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'.
- Default is 'standard', which is a mixed Julian/Gregorian calendar.
+ Default is 'standard'/'gregorian', which is a mixed 
+ Julian/Gregorian calendar.
 
 Returns a numeric time value, or an array of numeric time values.
 


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4691] branches/transforms/lib/matplotlib/backends

2007-12-10 Thread mdboom
Revision: 4691
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4691&view=rev
Author:   mdboom
Date: 2007-12-10 08:26:00 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Somehow the merge went awry last time.  Fixing.

Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_cairo.py
branches/transforms/lib/matplotlib/backends/backend_pdf.py
branches/transforms/lib/matplotlib/backends/backend_ps.py
branches/transforms/lib/matplotlib/backends/backend_svg.py

Modified: branches/transforms/lib/matplotlib/backends/backend_cairo.py
===
--- branches/transforms/lib/matplotlib/backends/backend_cairo.py
2007-12-10 16:23:52 UTC (rev 4690)
+++ branches/transforms/lib/matplotlib/backends/backend_cairo.py
2007-12-10 16:26:00 UTC (rev 4691)
@@ -118,7 +118,6 @@
 ctx.stroke()
 
 
-<<< .working
 [EMAIL PROTECTED]
 def convert_path(ctx, tpath):
 for points, code in tpath.iter_segments():
@@ -135,48 +134,12 @@
 elif code == Path.CLOSEPOLY:
 ctx.close_path()
 convert_path = staticmethod(convert_path)
-===
-def draw_path(self, gc, rgbFace, path):
-ctx = gc.ctx
-ctx.new_path()
->>> .merge-right.r4686
 
-<<< .working
 
 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.")
 
-===
-while 1:
-code, xp, yp = path.vertex()
-yp = self.height - yp
-
-if code == agg.path_cmd_stop:
-ctx.close_path()
-break
-elif code == agg.path_cmd_move_to:
-ctx.move_to(xp, yp)
-elif code == agg.path_cmd_line_to:
-ctx.line_to(xp, yp)
-elif code == agg.path_cmd_curve3:
-_, xp1, yp1 = path.vertex()
-yp1 = self.height - yp1
-ctx.curve_to(xp, yp, xp, yp, xp1, yp1)
-elif code == agg.path_cmd_curve4:
-_, xp1, yp1 = path.vertex()
-yp1 = self.height - yp1
-_, xp2, yp2 = path.vertex()
-yp2 = self.height - yp2
-ctx.curve_to(xp, yp, xp1, yp1, xp2, yp2)
-elif code == agg.path_cmd_end_poly:
-ctx.close_path()
-self._fill_and_stroke(ctx, rgbFace)
-
-def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2,
- rotation):
-if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
->>> .merge-right.r4686
 ctx = gc.ctx
 transform = transform + \
 Affine2D().scale(1.0, -1.0).translate(0, self.height)

Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py  2007-12-10 
16:23:52 UTC (rev 4690)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py  2007-12-10 
16:26:00 UTC (rev 4691)
@@ -1211,97 +1211,7 @@
 stat_key, (realpath, Set()))
 used_characters[1].update(set)
 
-<<< .working
 def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
-===
-def draw_arc(self, gcEdge, rgbFace, x, y, width, height,
- angle1, angle2, rotation):
-"""
-Draw an arc using GraphicsContext instance gcEdge, centered at x,y,
-with width and height and angles from 0.0 to 360.0
-0 degrees is at 3-o'clock, rotated by `rotation` degrees
-positive angles are anti-clockwise
-
-If the color rgbFace is not None, fill the arc with it.
-"""
-# source: agg_bezier_arc.cpp in agg23
-
-def arc_to_bezier(cx, cy, rx, ry, angle1, sweep, rotation):
-halfsweep = sweep / 2.0
-x0, y0 = cos(halfsweep), sin(halfsweep)
-tx = (1.0 - x0) * 4.0/3.0;
-ty = y0 - tx * x0 / y0;
-px =  x0, x0+tx, x0+tx, x0
-py = -y0,   -ty,ty, y0
-sn, cs = sin(angle1 + halfsweep), cos(angle1 + halfsweep)
-result = [ (rx * (pxi * cs - pyi * sn),
-ry * (pxi * sn + pyi * cs))
-   for pxi, pyi in zip(px, py) ]
-result = [ (cx + cos(rotation)*x - sin(rotation)*y,
-cy + sin(rotation)*x + cos(rotation)*y)
-   for x, y in result ]
-return reduce(lambda x, y: x + y, result)
-
-epsilon = 0.01
-angle1 *= pi/180.0
-angle2 *= pi/180.0
-rotation *= pi/180.0
-sweep = angle2 - angle1
-angle1 = angle1 % (2*pi)
-sweep = min(max(-2*pi, sweep), 2*pi)
-
-if sweep < 0.0:
-sweep, angle1, angle2 = -sweep, angle2, angle1
-   

SF.net SVN: matplotlib: [4692] trunk/toolkits/basemap/MANIFEST.in

2007-12-10 Thread jswhit
Revision: 4692
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4692&view=rev
Author:   jswhit
Date: 2007-12-10 08:27:25 -0800 (Mon, 10 Dec 2007)

Log Message:
---
include plotcities.py example

Modified Paths:
--
trunk/toolkits/basemap/MANIFEST.in

Modified: trunk/toolkits/basemap/MANIFEST.in
===
--- trunk/toolkits/basemap/MANIFEST.in  2007-12-10 16:26:00 UTC (rev 4691)
+++ trunk/toolkits/basemap/MANIFEST.in  2007-12-10 16:27:25 UTC (rev 4692)
@@ -30,6 +30,7 @@
 include examples/huralll020.shx
 include examples/hurrtracks.py
 include examples/fcover.dat
+include examples/plotcities.py
 include examples/plotmap.py
 include examples/plotmap_oo.py
 include examples/plotmap_masked.py
@@ -54,6 +55,9 @@
 include examples/ccsm_popgrid.py
 include examples/ccsm_popgrid.nc
 include examples/plot_tissot.py
+include examples/cities.dbf
+include examples/cities.shp
+include examples/cities.shx
 include examples/tissot.dbf
 include examples/tissot.shp
 include examples/tissot.shx


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4693] branches/transforms/lib/matplotlib/path.py

2007-12-10 Thread mdboom
Revision: 4693
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4693&view=rev
Author:   mdboom
Date: 2007-12-10 11:46:00 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Numpify arc/wedge approximation.

Modified Paths:
--
branches/transforms/lib/matplotlib/path.py

Modified: branches/transforms/lib/matplotlib/path.py
===
--- branches/transforms/lib/matplotlib/path.py  2007-12-10 16:27:25 UTC (rev 
4692)
+++ branches/transforms/lib/matplotlib/path.py  2007-12-10 19:46:00 UTC (rev 
4693)
@@ -408,10 +408,14 @@
 unit_circle = classmethod(unit_circle)
 
 [EMAIL PROTECTED]
-def arc(cls, theta1, theta2, is_wedge=False):
+def arc(cls, theta1, theta2, is_wedge=False, n=None):
 """
 Returns an arc on the unit circle from angle theta1 to angle
 theta2 (in degrees).
+
+If n is provided, it is the number of spline segments to make.
+If n is not provided, the number of spline segments is determined
+based on the delta between theta1 and theta2.
 """
 # From Masionobe, L.  2003.  "Drawing an elliptical arc using
 # polylines, quadratic or cubic Bezier curves".
@@ -422,7 +426,7 @@
 theta1 *= math.pi / 180.0
 theta2 *= math.pi / 180.0
 
-twopi = math.pi * 2.0
+twopi  = math.pi * 2.0
 halfpi = math.pi * 0.5
 
 eta1 = math.atan2(math.sin(theta1), math.cos(theta1))
@@ -432,7 +436,8 @@
 eta2 += twopi
 
 # number of curve segments to make
-n = int(2 ** math.ceil((eta2 - eta1) / halfpi))
+if n is None:
+n = int(2 ** math.ceil((eta2 - eta1) / halfpi))
 
 deta = (eta2 - eta1) / n
 etaB = eta1
@@ -450,7 +455,9 @@
 codes = Path.CURVE4 * npy.ones((length, ), Path.code_type)
 vertices[1] = [xB, yB]
 codes[0:2] = [Path.MOVETO, Path.LINETO]
+codes[-2:] = [Path.LINETO, Path.CLOSEPOLY]
 vertex_offset = 2
+end = length - 2
 else:
 length = n * 3 + 1
 vertices = npy.zeros((length, 2), npy.float_)
@@ -458,32 +465,31 @@
 vertices[0] = [xB, yB]
 codes[0] = Path.MOVETO
 vertex_offset = 1
+end = length
 
 t = math.tan(0.5 * deta)
 alpha = math.sin(deta) * (math.sqrt(4.0 + 3.0 * t * t) - 1) / 3.0
 
-for i in xrange(n):
-xA = xB
-yA = yB
-xA_dot = xB_dot
-yA_dot = yB_dot
+steps = npy.linspace(eta1, eta2, n + 1, True)
+cos_eta = npy.cos(steps)
+sin_eta = npy.sin(steps)
 
-etaB += deta
-cos_etaB = math.cos(etaB)
-sin_etaB = math.sin(etaB)
-xB = cos_etaB
-yB = sin_etaB
-xB_dot = -sin_etaB
-yB_dot = cos_etaB
+xA = cos_eta[:-1]
+yA = sin_eta[:-1]
+xA_dot = -yA
+yA_dot = xA
 
-offset = i*3 + vertex_offset
-vertices[offset:offset+3] = [
-[xA + alpha * xA_dot, yA + alpha * yA_dot],
-[xB - alpha * xB_dot, yB - alpha * yB_dot],
-[xB, yB]]
+xB = cos_eta[1:]
+yB = sin_eta[1:]
+xB_dot = -yB
+yB_dot = xB
 
-if is_wedge:
-codes[-2:] = [Path.LINETO, Path.CLOSEPOLY]
+vertices[vertex_offset  :end:3, 0] = xA + alpha * xA_dot
+vertices[vertex_offset  :end:3, 1] = yA + alpha * yA_dot
+vertices[vertex_offset+1:end:3, 0] = xB - alpha * xB_dot
+vertices[vertex_offset+1:end:3, 1] = yB - alpha * yB_dot
+vertices[vertex_offset+2:end:3, 0] = xB
+vertices[vertex_offset+2:end:3, 1] = yB
 
 return Path(vertices, codes)
 arc = classmethod(arc)


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4694] branches/transforms/lib/matplotlib/path.py

2007-12-10 Thread mdboom
Revision: 4694
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4694&view=rev
Author:   mdboom
Date: 2007-12-10 11:53:12 -0800 (Mon, 10 Dec 2007)

Log Message:
---
Simplify even more

Modified Paths:
--
branches/transforms/lib/matplotlib/path.py

Modified: branches/transforms/lib/matplotlib/path.py
===
--- branches/transforms/lib/matplotlib/path.py  2007-12-10 19:46:00 UTC (rev 
4693)
+++ branches/transforms/lib/matplotlib/path.py  2007-12-10 19:53:12 UTC (rev 
4694)
@@ -440,20 +440,28 @@
 n = int(2 ** math.ceil((eta2 - eta1) / halfpi))
 
 deta = (eta2 - eta1) / n
-etaB = eta1
+t = math.tan(0.5 * deta)
+alpha = math.sin(deta) * (math.sqrt(4.0 + 3.0 * t * t) - 1) / 3.0
 
-cos_etaB = math.cos(etaB)
-sin_etaB = math.sin(etaB)
-xB = cos_etaB
-yB = sin_etaB
-xB_dot = -sin_etaB
-yB_dot = cos_etaB
+steps = npy.linspace(eta1, eta2, n + 1, True)
+cos_eta = npy.cos(steps)
+sin_eta = npy.sin(steps)
 
+xA = cos_eta[:-1]
+yA = sin_eta[:-1]
+xA_dot = -yA
+yA_dot = xA
+
+xB = cos_eta[1:]
+yB = sin_eta[1:]
+xB_dot = -yB
+yB_dot = xB
+
 if is_wedge:
 length = n * 3 + 4
 vertices = npy.zeros((length, 2), npy.float_)
 codes = Path.CURVE4 * npy.ones((length, ), Path.code_type)
-vertices[1] = [xB, yB]
+vertices[1] = [xA[0], yA[0]]
 codes[0:2] = [Path.MOVETO, Path.LINETO]
 codes[-2:] = [Path.LINETO, Path.CLOSEPOLY]
 vertex_offset = 2
@@ -462,28 +470,11 @@
 length = n * 3 + 1
 vertices = npy.zeros((length, 2), npy.float_)
 codes = Path.CURVE4 * npy.ones((length, ), Path.code_type)
-vertices[0] = [xB, yB]
+vertices[0] = [xA[0], yA[0]]
 codes[0] = Path.MOVETO
 vertex_offset = 1
 end = length
 
-t = math.tan(0.5 * deta)
-alpha = math.sin(deta) * (math.sqrt(4.0 + 3.0 * t * t) - 1) / 3.0
-
-steps = npy.linspace(eta1, eta2, n + 1, True)
-cos_eta = npy.cos(steps)
-sin_eta = npy.sin(steps)
-
-xA = cos_eta[:-1]
-yA = sin_eta[:-1]
-xA_dot = -yA
-yA_dot = xA
-
-xB = cos_eta[1:]
-yB = sin_eta[1:]
-xB_dot = -yB
-yB_dot = xB
-
 vertices[vertex_offset  :end:3, 0] = xA + alpha * xA_dot
 vertices[vertex_offset  :end:3, 1] = yA + alpha * yA_dot
 vertices[vertex_offset+1:end:3, 0] = xB - alpha * xB_dot


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4695] trunk/toolkits/basemap/lib/dap

2007-12-10 Thread jswhit
Revision: 4695
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4695&view=rev
Author:   jswhit
Date: 2007-12-10 12:32:26 -0800 (Mon, 10 Dec 2007)

Log Message:
---
updated from pydap svn

Modified Paths:
--
trunk/toolkits/basemap/lib/dap/lib.py
trunk/toolkits/basemap/lib/dap/parsers/das.py

Modified: trunk/toolkits/basemap/lib/dap/lib.py
===
--- trunk/toolkits/basemap/lib/dap/lib.py   2007-12-10 19:53:12 UTC (rev 
4694)
+++ trunk/toolkits/basemap/lib/dap/lib.py   2007-12-10 20:32:26 UTC (rev 
4695)
@@ -8,7 +8,7 @@
 from urllib import quote as _quote
 
 __author__ = 'Roberto De Almeida <[EMAIL PROTECTED]>'
-__version__ = (2,2,6,1)  # module version
+__version__ = (2,2,6,2)  # module version
 __dap__ = (2,0)# protocol version
 
 # Constants that used to live in __init__.py but had to be moved

Modified: trunk/toolkits/basemap/lib/dap/parsers/das.py
===
--- trunk/toolkits/basemap/lib/dap/parsers/das.py   2007-12-10 19:53:12 UTC 
(rev 4694)
+++ trunk/toolkits/basemap/lib/dap/parsers/das.py   2007-12-10 20:32:26 UTC 
(rev 4695)
@@ -222,7 +222,7 @@
 
 if type_.lower() in ['string', 'url']:
 value = expr_eval(repr(value))
-value = value[1:-1]  # strip ""
+value = value.strip('"')
 elif type_.lower() == 'alias':
 # Support for Alias is not documented in the DAP spec. I based
 # this on the Java documentation from the OPeNDAP website at:
@@ -241,24 +241,15 @@
 break
 else:
 value = value.attributes
-else:
-dtype = {'float64': 'd',
- 'float32': 'f',
- 'int32'  : 'l',
- 'int16'  : 'h',
- 'uint32' : 'L',
- 'uint16' : 'H',
- 'byte'   : 'B',
-}[type_.lower()]
+elif type_.lower() == 'float32':
 # Convert to right precision; otherwise floats 
 # are converted to Float64 automatically by 
 # Python.
-# B. Granger 5/17/07 - This line is giving a DeprecationWarning
-# when dtype = 'l'.  It looks like it doesn't like getting a 
float
-# when a long int is expected.  Because this is in a critical
-# code path that I don't know well, and it seems to work OK 
for now
-# I didn't change anything.  Should be looked into though.
-value = array.array(dtype, [float(value)])[0]
+value = array.array('f', [float(value)])[0]
+elif type_.lower() == 'float64':
+value = array.array('d', [float(value)])[0]
+else:
+value = int(value)
 values.append(value)
 
 if self._check(','): self._consume(',')


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4696] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/basemap.py

2007-12-10 Thread jswhit
Revision: 4696
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4696&view=rev
Author:   jswhit
Date: 2007-12-10 13:06:59 -0800 (Mon, 10 Dec 2007)

Log Message:
---
fix bug in geometry intersection error handling

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-12-10 20:32:26 UTC (rev 4695)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py   
2007-12-10 21:06:59 UTC (rev 4696)
@@ -826,7 +826,7 @@
 try:
 geoms = poly.intersection(boundarypolyll)
 except:
-pass
+continue
 # iterate over geometries in intersection.
 for psub in geoms:
 # only coastlines are polygons,
@@ -880,7 +880,7 @@
 try:
 geoms = poly.intersection(boundarypolyxy)
 except:
-pass
+continue
 # iterate over geometries in intersection.
 for psub in geoms:
 b = psub.boundary


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

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins