SF.net SVN: matplotlib: [4697] trunk/matplotlib/lib/matplotlib/ backend_bases.py
Revision: 4697
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4697&view=rev
Author: pkienzle
Date: 2007-12-11 09:14:44 -0800 (Tue, 11 Dec 2007)
Log Message:
---
remove wx specific gui_repaint comment
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backend_bases.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===
--- trunk/matplotlib/lib/matplotlib/backend_bases.py2007-12-10 21:06:59 UTC
(rev 4696)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py2007-12-11 17:14:44 UTC
(rev 4697)
@@ -953,7 +953,6 @@
a.set_facecolor('lightblue')
else: self._active[a] = None
self.draw_idle()
-#self.gui_repaint()
def pick(self, mouseevent):
if not self.widgetlock.locked():
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: [4698] trunk/matplotlib
Revision: 4698
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4698&view=rev
Author: jdh2358
Date: 2007-12-11 13:17:59 -0800 (Tue, 11 Dec 2007)
Log Message:
---
fixed text with dash bug
Modified Paths:
--
trunk/matplotlib/examples/dashpointlabel.py
trunk/matplotlib/examples/lasso_demo.py
trunk/matplotlib/lib/matplotlib/cbook.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/examples/dashpointlabel.py
===
--- trunk/matplotlib/examples/dashpointlabel.py 2007-12-11 17:14:44 UTC (rev
4697)
+++ trunk/matplotlib/examples/dashpointlabel.py 2007-12-11 21:17:59 UTC (rev
4698)
@@ -1,4 +1,4 @@
-from matplotlib import pylab
+import pylab
DATA = ((1, 3),
(2, 4),
@@ -15,26 +15,27 @@
(1, 20, 30, 60, 10),
)
-def test_dashpointlabel(save=False):
-pylab.clf()
-(x,y) = zip(*DATA)
-pylab.plot(x, y, marker='o')
-for i in xrange(len(DATA)):
-(x,y) = DATA[i]
-(dd, dl, r, dr, dp) = dash_style[i]
-pylab.text(x, y, str((x,y)), withdash=True,
- dashdirection=dd,
- dashlength=dl,
- rotation=r,
- dashrotation=dr,
- dashpush=dp,
- )
-axis = pylab.gca()
-axis.set_xlim((0.0, 5.0))
-axis.set_ylim((0.0, 5.0))
-if save:
-pylab.savefig('dashpointlabel')
-pylab.show()
+fig = pylab.figure()
+ax = fig.add_subplot(111)
-if __name__ == '__main__':
-test_dashpointlabel()
+
+(x,y) = zip(*DATA)
+ax.plot(x, y, marker='o')
+for i in xrange(len(DATA)):
+(x,y) = DATA[i]
+(dd, dl, r, dr, dp) = dash_style[i]
+#print 'dashlen call', dl
+t = ax.text(x, y, str((x,y)), withdash=True,
+ dashdirection=dd,
+ dashlength=dl,
+ rotation=r,
+ dashrotation=dr,
+ dashpush=dp,
+ )
+
+ax.set_xlim((0.0, 5.0))
+ax.set_ylim((0.0, 5.0))
+#if save:
+#pylab.savefig('dashpointlabel')
+pylab.show()
+
Modified: trunk/matplotlib/examples/lasso_demo.py
===
--- trunk/matplotlib/examples/lasso_demo.py 2007-12-11 17:14:44 UTC (rev
4697)
+++ trunk/matplotlib/examples/lasso_demo.py 2007-12-11 21:17:59 UTC (rev
4698)
@@ -59,6 +59,7 @@
self.canvas.draw_idle()
self.canvas.widgetlock.release(self.lasso)
del self.lasso
+
def onpress(self, event):
if self.canvas.widgetlock.locked(): return
if event.inaxes is None: return
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===
--- trunk/matplotlib/lib/matplotlib/cbook.py2007-12-11 17:14:44 UTC (rev
4697)
+++ trunk/matplotlib/lib/matplotlib/cbook.py2007-12-11 21:17:59 UTC (rev
4698)
@@ -962,6 +962,10 @@
outstream.write("Examining: %r\n" % (obj,))
recurse(obj, obj, { }, [])
+
+
+
+
if __name__=='__main__':
assert( allequal([1,1,1]) )
assert(not allequal([1,1,0]) )
Modified: trunk/matplotlib/lib/matplotlib/text.py
===
--- trunk/matplotlib/lib/matplotlib/text.py 2007-12-11 17:14:44 UTC (rev
4697)
+++ trunk/matplotlib/lib/matplotlib/text.py 2007-12-11 21:17:59 UTC (rev
4698)
@@ -387,6 +387,11 @@
"Return the horizontal alignment as string"
return self._horizontalalignment
+
+def _get_xy_display(self):
+'get the (possibly unit converted) transformed x,y in display coords'
+return self.get_transform().xy_tup((self._x, self._y))
+
def get_position(self):
"Return x, y as tuple"
x = float(self.convert_xunits(self._x))
@@ -770,7 +775,26 @@
#self.set_bbox(dict(pad=0))
+def get_position(self):
+"Return x, y as tuple"
+x = float(self.convert_xunits(self._dashx))
+y = float(self.convert_yunits(self._dashy))
+return x, y
+
+def get_prop_tup(self):
+"""
+Return a hashable tuple of properties
+
+Not intended to be human readable, but useful for backends who
+want to cache derived information about text (eg layouts) and
+need to know if the text has changed
+"""
+props = [p for p in Text.get_prop_tup(self)]
+props.extend([self._x, self._y, self._dashlength, self._dashdirection,
self._dashrotation, self._dashpad, self._dashpush])
+return tuple(props)
+
def draw(self, renderer):
+self.cached = dict()
self.update_coords(renderer)
Text.draw(self, renderer)
if self.get_dashlength() > 0.0:
@@ -846,8 +870,12 @@
cwd *= 1+dashpad/npy.sqrt(npy.dot(cwd,cwd))
cw = c2+(dashdirection*2-1)*cwd
-self._x, self._y = transform.inverse_xy_tup(tuple(cw))
+
+newx, newy = tr
SF.net SVN: matplotlib: [4699] trunk/toolkits/basemap/Changelog
Revision: 4699 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4699&view=rev Author: jswhit Date: 2007-12-11 14:03:58 -0800 (Tue, 11 Dec 2007) Log Message: --- fixed exception handling bug in polygon intersection code. Modified Paths: -- trunk/toolkits/basemap/Changelog Modified: trunk/toolkits/basemap/Changelog === --- trunk/toolkits/basemap/Changelog2007-12-11 21:17:59 UTC (rev 4698) +++ trunk/toolkits/basemap/Changelog2007-12-11 22:03:58 UTC (rev 4699) @@ -1,4 +1,7 @@ version 0.9.9 (not yet released) + * fixed exception handling bug in code that looks for + intersection between boundary feature and map projection + region. * 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 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: [4700] branches/transforms
Revision: 4700
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4700&view=rev
Author: mdboom
Date: 2007-12-11 16:15:23 -0800 (Tue, 11 Dec 2007)
Log Message:
---
Added (experimental) support for large arcs
Modified Paths:
--
branches/transforms/lib/matplotlib/patches.py
branches/transforms/lib/matplotlib/path.py
branches/transforms/src/_path.cpp
branches/transforms/unit/ellipse_compare.py
branches/transforms/unit/ellipse_large.py
Modified: branches/transforms/lib/matplotlib/patches.py
===
--- branches/transforms/lib/matplotlib/patches.py 2007-12-11 22:03:58 UTC
(rev 4699)
+++ branches/transforms/lib/matplotlib/patches.py 2007-12-12 00:15:23 UTC
(rev 4700)
@@ -839,6 +839,7 @@
self._width, self._height = width, height
self._angle = angle
self._recompute_transform()
+self._path = Path.unit_circle()
def _recompute_transform(self):
self._patch_transform = transforms.Affine2D() \
@@ -850,7 +851,7 @@
"""
Return the vertices of the rectangle
"""
- return Path.unit_circle()
+ return self._path
def get_patch_transform(self):
return self._patch_transform
@@ -881,7 +882,6 @@
self._recompute_transform()
angle = property(_get_angle, _set_angle)
-
class Circle(Ellipse):
"""
A circle patch
@@ -908,7 +908,180 @@
Ellipse.__init__(self, xy, radius*2, radius*2, **kwargs)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
+class Arc(Ellipse):
+"""
+An elliptical arc. Because it performs various optimizations, it may not
be
+filled.
+"""
+def __str__(self):
+return
"Arc(%d,%d;%dx%d)"%(self.center[0],self.center[1],self.width,self.height)
+def __init__(self, xy, width, height, angle=0.0, theta1=0.0, theta2=360.0,
**kwargs):
+"""
+xy - center of ellipse
+width - length of horizontal axis
+height - length of vertical axis
+angle - rotation in degrees (anti-clockwise)
+theta1 - starting angle of the arc in degrees
+theta2 - ending angle of the arc in degrees
+
+If theta1 and theta2 are not provided, the arc will form a
+complete ellipse.
+
+Valid kwargs are:
+%(Patch)s
+"""
+fill = kwargs.pop('fill')
+if fill:
+raise ValueError("Arc objects can not be filled")
+kwargs['fill'] = False
+
+Ellipse.__init__(self, xy, width, height, angle, **kwargs)
+
+self._theta1 = theta1
+self._theta2 = theta2
+
+def draw(self, renderer):
+"""
+Ellipses are normally drawn using an approximation that uses
+eight cubic bezier splines. The error of this approximation
+is 1.89818e-6, according to this unverified source:
+
+ Lancaster, Don. Approximating a Circle or an Ellipse Using
+ Four Bezier Cubic Splines.
+
+ http://www.tinaja.com/glib/ellipse4.pdf
+
+There is a use case where very large ellipses must be drawn
+with very high accuracy, and it is too expensive to render the
+entire ellipse with enough segments (either splines or line
+segments). Therefore, in the case where either radius of the
+ellipse is large enough that the error of the spline
+approximation will be visible (greater than one pixel offset
+from the ideal), a different technique is used.
+
+In that case, only the visible parts of the ellipse are drawn,
+with each visible arc using a fixed number of spline segments
+(8). The algorithm proceeds as follows:
+
+ 1. The points where the ellipse intersects the axes bounding
+ box are located. (This is done be performing an inverse
+ transformation on the axes bbox such that it is relative to
+ the unit circle -- this makes the intersection calculation
+ much easier than doing rotated ellipse intersection
+ directly).
+
+ This uses the "line intersecting a circle" algorithm from:
+
+Vince, John. Geometry for Computer Graphics: Formulae,
+Examples & Proofs. London: Springer-Verlag, 2005.
+
+ 2. The angles of each of the intersection points are
+ calculated.
+
+ 3. Proceeding counterclockwise starting in the positive
+ x-direction, each of the visible arc-segments between the
+ pairs of vertices are drawn using the bezier arc
+ approximation technique implemented in Path.arc().
+"""
+# Get the width and height in pixels
+width, height = self.get_transform().transform_point(
+(self._width, self._height))
+inv_error = (1.0 / 1.89818e-6)
+
+if width < inv_error and height < inv_error and False:
+self._path
