SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

Revision: 3603
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3603&view=rev
Author: pkienzle
Date: 2007年07月21日 16:30:03 -0700 (2007年7月21日)
Log Message:
-----------
Remove unnecessary 'import math' from inellipse()
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2007年07月21日 19:28:34 UTC (rev 3602)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2007年07月21日 23:30:03 UTC (rev 3603)
@@ -736,7 +736,6 @@
 
 
 def inellipse(x,y,cx,cy,a,b,angle):
- import math
 x,y = x-cx,y-cy
 theta = math.atan2(x,y) + math.radians(angle)
 rsq = x*x+y*y
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jr...@us...> - 2007年10月05日 16:29:19
Revision: 3920
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3920&view=rev
Author: jrevans
Date: 2007年10月05日 09:29:17 -0700 (2007年10月05日)
Log Message:
-----------
Fixed a typo in the Ellipse code that was causing the ellipse angle to go in the wrong direction. When I was testing I had forgotten to turn off the axes inversion test.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2007年10月05日 06:58:15 UTC (rev 3919)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2007年10月05日 16:29:17 UTC (rev 3920)
@@ -815,8 +815,8 @@
 angle = self.angle * math.pi / 180.0
 
 # convert the angle to polar coordinates (Assume r = 1.0)
- anglex = math.cos(-angle)
- angley = math.sin(-angle)
+ anglex = math.cos(angle)
+ angley = math.sin(angle)
 
 # transform the angle vertex and the origin
 angle_verts = npy.array(((anglex, angley), (0.0, 0.0)), npy.float)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年11月09日 21:27:31
Revision: 4199
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4199&view=rev
Author: mdboom
Date: 2007年11月09日 13:27:30 -0800 (2007年11月09日)
Log Message:
-----------
Bugfix: [ 1732274 ] No antialiasing with pie on wxpython
Reducing the sampling of the curve on the wedge looks much better.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2007年11月09日 21:09:04 UTC (rev 4198)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2007年11月09日 21:27:30 UTC (rev 4199)
@@ -511,7 +511,7 @@
 def __str__(self):
 return "Wedge(%g,%g)"%self.xy[0]
 def __init__(self, center, r, theta1, theta2,
- dtheta=0.1, **kwargs):
+ dtheta=5.0, **kwargs):
 """
 Draw a wedge centered at x,y tuple center with radius r that
 sweeps theta1 to theta2 (angles)
@@ -523,7 +523,11 @@
 
 """
 xc, yc = center
- rads = (math.pi/180.)*npy.arange(theta1, theta2+0.1*dtheta, dtheta)
+ theta1 = float(theta1)
+ theta2 = float(theta2)
+ dtheta = float(dtheta)
+ num_points = abs(theta2 - theta1) / dtheta
+ rads = (npy.pi/180.) * npy.linspace(theta1, theta2, num_points, endpoint=True)
 xs = r*npy.cos(rads)+xc
 ys = r*npy.sin(rads)+yc
 verts = [center]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年11月12日 18:54:54
Revision: 4233
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4233&view=rev
Author: mdboom
Date: 2007年11月12日 10:54:49 -0800 (2007年11月12日)
Log Message:
-----------
[ 1660316 ] PolyInteractor verts call 
Should be calling get_verts() instead of .verts.
(Thanks JPaul Rinehimer)
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2007年11月12日 18:53:25 UTC (rev 4232)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2007年11月12日 18:54:49 UTC (rev 4233)
@@ -992,7 +992,7 @@
 raise RuntimeError('You must first add the polygon to a figure or canvas before defining the interactor')
 canvas = poly.figure.canvas
 self.poly = poly
- self.poly.verts = list(self.poly.verts)
+ self.poly.verts = list(self.poly.get_verts())
 x, y = zip(*self.poly.verts)
 self.line = lines.Line2D(x,y,marker='o', markerfacecolor='r')
 #self._update_line(poly)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年12月10日 15:23:33
Revision: 4684
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4684&view=rev
Author: mdboom
Date: 2007年12月10日 07:23:08 -0800 (2007年12月10日)
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.
From: <md...@us...> - 2007年12月21日 15:09:15
Revision: 4783
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4783&view=rev
Author: mdboom
Date: 2007年12月21日 07:08:38 -0800 (2007年12月21日)
Log Message:
-----------
Add size-dependent highly-accurate arc drawing.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2007年12月20日 17:18:12 UTC (rev 4782)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2007年12月21日 15:08:38 UTC (rev 4783)
@@ -973,6 +973,337 @@
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
 
+class Arc(Ellipse):
+ """
+ An elliptical arc. Because it performs various optimizations, it
+ can 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), which should be adequate when the number of pixels across
+ the image is less than 5e5. 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 each
+ pair of intersections are drawn using the bezier arc
+ approximation technique implemented in arc().
+ """
+ # Do the usual GC handling stuff
+ if not self.get_visible(): return
+ gc = renderer.new_gc()
+ gc.set_foreground(self._edgecolor)
+ gc.set_linewidth(self._linewidth)
+ gc.set_alpha(self._alpha)
+ gc.set_antialiased(self._antialiased)
+ self._set_gc_clip(gc)
+ gc.set_capstyle('projecting')
+ if not self.fill or self._facecolor is None: rgbFace = None
+ else: rgbFace = colors.colorConverter.to_rgb(self._facecolor)
+ if self._hatch:
+ gc.set_hatch(self._hatch )
+
+ def iter_circle_intersect_on_line(x0, y0, x1, y1):
+ dx = x1 - x0
+ dy = y1 - y0
+ dr2 = dx*dx + dy*dy
+ D = x0*y1 - x1*y0
+ D2 = D*D
+ discrim = dr2 - D2
+
+ # Single (tangential) intersection
+ if discrim == 0.0:
+ x = (D*dy) / dr2
+ y = (-D*dx) / dr2
+ yield x, y
+ elif discrim > 0.0:
+ # The definition of "sign" here is different from
+ # npy.sign: we never want to get 0.0
+ if dy < 0.0:
+ sign_dy = -1.0
+ else:
+ sign_dy = 1.0
+ sqrt_discrim = npy.sqrt(discrim)
+ for sign in (1., -1.):
+ x = (D*dy + sign * sign_dy * dx * sqrt_discrim) / dr2
+ y = (-D*dx + sign * npy.abs(dy) * sqrt_discrim) / dr2
+ yield x, y
+
+ def iter_circle_intersect_on_line_seg(x0, y0, x1, y1):
+ epsilon = 1e-9
+ if x1 < x0:
+ x0e, x1e = x1, x0
+ else:
+ x0e, x1e = x0, x1
+ if y1 < y0:
+ y0e, y1e = y1, y0
+ else:
+ y0e, y1e = y0, y1
+ x0e -= epsilon
+ y0e -= epsilon
+ x1e += epsilon
+ y1e += epsilon
+ for x, y in iter_circle_intersect_on_line(x0, y0, x1, y1):
+ if x >= x0e and x <= x1e and y >= y0e and y <= y1e:
+ yield x, y
+
+ def arc(theta1, theta2, trans, n=None):
+ """
+ Returns an arc on the unit circle from angle theta1 to
+ angle theta2 (in degrees). The returned arc is already
+ transformed using the affine transformation matrix trans.
+ The arc is returned as an agg::path_storage object.
+
+ 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".
+ #
+ # http://www.spaceroots.org/documents/ellipse/index.html
+
+ # degrees to radians
+ theta1 *= npy.pi / 180.0
+ theta2 *= npy.pi / 180.0
+
+ twopi = npy.pi * 2.0
+ halfpi = npy.pi * 0.5
+
+ eta1 = npy.arctan2(npy.sin(theta1), npy.cos(theta1))
+ eta2 = npy.arctan2(npy.sin(theta2), npy.cos(theta2))
+ eta2 -= twopi * npy.floor((eta2 - eta1) / twopi)
+ if (theta2 - theta1 > npy.pi) and (eta2 - eta1 < npy.pi):
+ eta2 += twopi
+
+ # number of curve segments to make
+ if n is None:
+ n = int(2 ** npy.ceil((eta2 - eta1) / halfpi))
+
+ deta = (eta2 - eta1) / n
+ t = npy.tan(0.5 * deta)
+ alpha = npy.sin(deta) * (npy.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
+
+ length = n * 3 + 1
+ vertices = npy.zeros((length, 2), npy.float_)
+ vertices[0] = [xA[0], yA[0]]
+ end = length
+
+ vertices[1::3, 0] = xA + alpha * xA_dot
+ vertices[1::3, 1] = yA + alpha * yA_dot
+ vertices[2::3, 0] = xB - alpha * xB_dot
+ vertices[2::3, 1] = yB - alpha * yB_dot
+ vertices[3::3, 0] = xB
+ vertices[3::3, 1] = yB
+
+ vertices = affine_transform(vertices, trans)
+
+ path = agg.path_storage()
+ path.move_to(*vertices[0])
+ for i in range(1, length, 3):
+ path.curve4(*vertices[i:i+3].flat)
+ return path
+
+ def point_in_polygon(x, y, poly):
+ inside = False
+ for i in range(len(poly) - 1):
+ p1x, p1y = poly[i]
+ p2x, p2y = poly[i+1]
+ if p1x < p2x:
+ xmin, xmax = p1x, p2x
+ else:
+ xmin, xmax = p2x, p1x
+ if p1y < p2y:
+ ymin, ymax = p1y, p2y
+ else:
+ ymin, ymax = p2y, p1y
+ if (y > ymin and
+ y <= ymax and
+ x <= xmax):
+ xinters = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x
+ if p1x == p2x or x <= xinters:
+ inside = not inside
+ return inside
+
+ def affine_transform(vertices, transform):
+ # This may seem silly, but it's faster than expanding the
+ # vertices array to Nx3 and then back to Nx2
+ transform = transform.copy()
+ transform[0, 1], transform[1, 0] = transform[1, 0], transform[0, 1]
+ vertices = npy.dot(vertices, transform[0:2, 0:2])
+ vertices += transform[0:2, 2:].flat
+ return vertices
+
+ # Set up the master transform from unit circle, all the way to
+ # display space.
+ trans = self.get_transform()
+ scale = npy.array(
+ [[self.width * 0.5, 0.0, 0.0],
+ [0.0, self.height * 0.5, 0.0],
+ [0.0, 0.0, 1.0]], npy.float_)
+ theta = (self.angle / 180.0) * npy.pi
+ rotate = npy.array(
+ [[npy.cos(theta), -npy.sin(theta), 0.0],
+ [npy.sin(theta), npy.cos(theta), 0.0],
+ [0.0, 0.0, 1.0]], npy.float_)
+ translate = npy.array(
+ [[1.0, 0.0, self.center[0]],
+ [0.0, 1.0, self.center[1]],
+ [0.0, 0.0, 1.0]], npy.float_)
+ sx, b, c, sy, tx, ty = trans.as_vec6_val()
+ dataTrans = npy.array(
+ [[sx, b, tx],
+ [c, sy, ty],
+ [0, 0, 1]], npy.float_)
+ mainTrans = \
+ npy.dot(
+ npy.dot(
+ npy.dot(dataTrans, translate), rotate), scale)
+
+ # Determine the size of the ellipse in pixels, and use
+ # that as a threshold to use the fast (whole ellipse)
+ # technique or accurate (partial arcs) technique.
+ size = affine_transform(
+ npy.array([[self.width, self.height]], npy.float_),
+ mainTrans)
+ width = size[0,0]
+ height = size[0,1]
+ # We divide the error in half, to just be *really*
+ # conservative
+ inv_error = (1.0 / 1.89818e-6) * 0.5
+
+ if width < inv_error and height < inv_error:
+ path = arc(self._theta1, self._theta2, mainTrans)
+ renderer.draw_path(gc, rgbFace, path)
+ return
+
+ # Transforms the axes box_path so that it is relative to the unit
+ # circle in the same way that it is relative to the desired
+ # ellipse.
+ axes_bbox = self.axes.bbox
+ box_path = npy.array(
+ [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]],
+ npy.float_)
+ axesTrans = npy.array(
+ [[axes_bbox.width(), 0.0, axes_bbox.xmin()],
+ [0.0, axes_bbox.height(), axes_bbox.ymin()],
+ [0.0, 0.0, 1.0]], npy.float_)
+ boxTrans = npy.dot(npy.linalg.inv(mainTrans), axesTrans)
+ box_path = affine_transform(box_path, boxTrans)
+
+ PI = npy.pi
+ TWOPI = PI * 2.0
+ RAD2DEG = 180.0 / PI
+ DEG2RAD = PI / 180.0
+ theta1 = self._theta1
+ theta2 = self._theta2
+ thetas = {}
+ # For each of the point pairs, there is a line segment
+ for p0, p1 in zip(box_path[:-1], box_path[1:]):
+ x0, y0 = p0
+ x1, y1 = p1
+ for x, y in iter_circle_intersect_on_line_seg(x0, y0, x1, y1):
+ theta = npy.arccos(x)
+ if y < 0:
+ theta = TWOPI - theta
+ # Convert radians to angles
+ theta *= RAD2DEG
+ if theta > theta1 and theta < theta2:
+ thetas[theta] = None
+
+ thetas = thetas.keys()
+ thetas.sort()
+ thetas.append(theta2)
+
+ last_theta = theta1
+ theta1_rad = theta1 * DEG2RAD
+ inside = point_in_polygon(npy.cos(theta1_rad), npy.sin(theta1_rad), box_path)
+ for theta in thetas:
+ if inside:
+ path = arc(last_theta, theta, mainTrans, 8)
+ renderer.draw_path(gc, rgbFace, path)
+ inside = False
+ else:
+ inside = True
+ last_theta = theta
+
+
 class PolygonInteractor:
 """
 An polygon editor.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年01月09日 18:37:59
Revision: 4829
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4829&view=rev
Author: mdboom
Date: 2008年01月09日 10:37:50 -0800 (2008年1月09日)
Log Message:
-----------
Fix shadows of legends.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年01月09日 17:59:17 UTC (rev 4828)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年01月09日 18:37:50 UTC (rev 4829)
@@ -107,13 +107,8 @@
 return self.get_path().get_extents(self.get_transform())
 
 def get_transform(self):
- return self._combined_transform
+ return self.get_patch_transform() + artist.Artist.get_transform(self)
 
- def set_transform(self, t):
- artist.Artist.set_transform(self, t)
- self._combined_transform = self.get_patch_transform() + \
- artist.Artist.get_transform(self)
-
 def get_data_transform(self):
 return artist.Artist.get_transform(self)
 
@@ -387,13 +382,9 @@
 height = self.convert_yunits(self._height)
 bbox = transforms.Bbox.from_bounds(x, y, width, height)
 self._rect_transform = transforms.BboxTransformTo(bbox)
- self._combined_transform = self._rect_transform + artist.Artist.get_transform(self)
 
- def draw(self, renderer):
- self._update_patch_transform()
- Patch.draw(self, renderer)
-
 def get_patch_transform(self):
+ self._update_patch_transform()
 	return self._rect_transform
 
 def contains(self, mouseevent):
@@ -513,27 +504,25 @@
 return self._orientation
 def _set_orientation(self, xy):
 self._orientation = xy
- self._update_transform()
 orientation = property(_get_orientation, _set_orientation)
 
 def _get_radius(self):
 return self._radius
 def _set_radius(self, xy):
 self._radius = xy
- self._update_transform()
 radius = property(_get_radius, _set_radius)
 
 def _get_numvertices(self):
 return self._numVertices
 def _set_numvertices(self, numVertices):
 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):
+ self._update_transform()
 return self._poly_transform
 
 class PathPatch(Patch):
@@ -606,22 +595,16 @@
 self._patch_transform = transforms.IdentityTransform()
 self._path = Path.wedge(self.theta1, self.theta2)
 
- def draw(self, renderer):
+ def get_path(self):
+	return self._path
+
+ def get_patch_transform(self):
 x = self.convert_xunits(self.center[0])
 y = self.convert_yunits(self.center[1])
 rx = self.convert_xunits(self.r)
 ry = self.convert_yunits(self.r)
 self._patch_transform = transforms.Affine2D() \
 .scale(rx, ry).translate(x, y)
- self._combined_transform = self._patch_transform + \
- artist.Artist.get_transform(self)
- Patch.draw(self, renderer)
- __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
-
- def get_path(self):
-	return self._path
-
- def get_patch_transform(self):
 	return self._patch_transform
 
 # COVERAGE NOTE: Not used internally or from examples
@@ -874,13 +857,7 @@
 	 .scale(width * 0.5, height * 0.5) \
 	 .rotate_deg(self.angle) \
 	 .translate(*center)
- self._combined_transform = self._patch_transform + \
- artist.Artist.get_transform(self)
 
- def draw(self, renderer):
- self._recompute_transform()
- Patch.draw(self, renderer)
-
 def get_path(self):
 """
 Return the vertices of the rectangle
@@ -888,6 +865,7 @@
 	return self._path
 
 def get_patch_transform(self):
+ self._recompute_transform()
 return self._patch_transform
 
 def contains(self,ev):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年03月11日 12:07:16
Revision: 5000
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5000&view=rev
Author: mdboom
Date: 2008年03月11日 05:07:10 -0700 (2008年3月11日)
Log Message:
-----------
Fixing Arrow patch (as submitted by Michael Fitzgerald)
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年03月10日 15:18:49 UTC (rev 4999)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年03月11日 12:07:10 UTC (rev 5000)
@@ -608,7 +608,7 @@
 return self._patch_transform
 
 # COVERAGE NOTE: Not used internally or from examples
-class Arrow(Polygon):
+class Arrow(Patch):
 """
 An arrow patch
 """
@@ -628,13 +628,14 @@
 Valid kwargs are:
 %(Patch)s
 """
+ Patch.__init__(self, **kwargs)
 L = npy.sqrt(dx**2+dy**2) or 1 # account for div by zero
 cx = float(dx)/L
 sx = float(dy)/L
 
 trans1 = transforms.Affine2D().scale(L, width)
 trans2 = transforms.Affine2D.from_values(cx, sx, -sx, cx, 0.0, 0.0)
- trans3 = transforms.Affine2d().translate(x, y)
+ trans3 = transforms.Affine2D().translate(x, y)
 trans = trans1 + trans2 + trans3
 self._patch_transform = trans.frozen()
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年06月05日 19:14:55
Revision: 5405
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5405&view=rev
Author: mdboom
Date: 2008年06月05日 12:14:53 -0700 (2008年6月05日)
Log Message:
-----------
Close polygons.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年06月05日 17:33:24 UTC (rev 5404)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年06月05日 19:14:53 UTC (rev 5405)
@@ -540,6 +540,9 @@
 See Patch documentation for additional kwargs
 """
 Patch.__init__(self, **kwargs)
+ xy = np.asarray(xy, np.float_)
+ if len(xy) and xy[0] != xy[-1]:
+ xy = np.concatenate([xy, [xy[0]]])
 self._path = Path(xy)
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2008年06月17日 14:05:51
Revision: 5569
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5569&view=rev
Author: jdh2358
Date: 2008年06月17日 07:04:19 -0700 (2008年6月17日)
Log Message:
-----------
added get_verts method to patches
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年06月17日 13:02:56 UTC (rev 5568)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年06月17日 14:04:19 UTC (rev 5569)
@@ -80,6 +80,14 @@
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
 
+ def get_verts(self):
+ """
+ return a copy of the vertices used in this patch
+ """
+ trans = self.get_transform()
+ path = self.get_path()
+ tverts = trans.transform(path.vertices)
+ return tverts
 
 def contains(self, mouseevent):
 """Test whether the mouse event occurred in the patch.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <mme...@us...> - 2008年06月20日 11:58:04
Revision: 5609
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5609&view=rev
Author: mmetz_bn
Date: 2008年06月20日 04:58:01 -0700 (2008年6月20日)
Log Message:
-----------
Oops: bug fixed Polygon set_closed
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年06月20日 11:54:55 UTC (rev 5608)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年06月20日 11:58:01 UTC (rev 5609)
@@ -577,7 +577,7 @@
 xy = np.concatenate([xy, [xy[0]]])
 else:
 if len(xy)>2 and (xy[0]==xy[-1]).all():
- xy = xy[0:-2]
+ xy = xy[0:-1]
 self._set_xy(xy)
 
 def _get_xy(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年06月22日 08:08:24
Revision: 5627
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5627&view=rev
Author: mdboom
Date: 2008年06月21日 14:07:54 -0700 (2008年6月21日)
Log Message:
-----------
Fixing [ matplotlib-Bugs-1994535 ] still missing lines on graph with svn (r 5548)
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年06月21日 17:07:25 UTC (rev 5626)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年06月21日 21:07:54 UTC (rev 5627)
@@ -596,6 +596,8 @@
 return self._path.vertices
 def set_xy(self, vertices):
 self._path = Path(vertices)
+ _get_xy = get_xy
+ _set_xy = set_xy
 xy = property(
 get_xy, set_xy, None,
 """Set/get the vertices of the polygon. This property is
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2008年06月23日 14:47:23
Revision: 5645
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5645&view=rev
Author: jdh2358
Date: 2008年06月23日 07:46:13 -0700 (2008年6月23日)
Log Message:
-----------
commited olle's linestyle patch patch
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年06月23日 12:58:30 UTC (rev 5644)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年06月23日 14:46:13 UTC (rev 5645)
@@ -55,6 +55,7 @@
 edgecolor=None,
 facecolor=None,
 linewidth=None,
+ linestyle=None,
 antialiased = None,
 hatch = None,
 fill=True,
@@ -67,11 +68,13 @@
 artist.Artist.__init__(self)
 
 if linewidth is None: linewidth = mpl.rcParams['patch.linewidth']
+ if linestyle is None: linestyle = "solid"
 if antialiased is None: antialiased = mpl.rcParams['patch.antialiased']
 
 self.set_edgecolor(edgecolor)
 self.set_facecolor(facecolor)
 self.set_linewidth(linewidth)
+ self.set_linestyle(linestyle)
 self.set_antialiased(antialiased)
 self.set_hatch(hatch)
 self.fill = fill
@@ -118,6 +121,7 @@
 self.set_fill(other.get_fill())
 self.set_hatch(other.get_hatch())
 self.set_linewidth(other.get_linewidth())
+ self.set_linestyle(other.get_linestyle)
 self.set_transform(other.get_data_transform())
 self.set_figure(other.get_figure())
 self.set_alpha(other.get_alpha())
@@ -149,6 +153,10 @@
 def get_linewidth(self):
 return self._linewidth
 get_lw = get_linewidth
+ 
+ def get_linestyle(self):
+ return self._linestyle
+ get_ls = get_linestyle
 
 def set_antialiased(self, aa):
 """
@@ -189,7 +197,17 @@
 if w is None: w = mpl.rcParams['patch.linewidth']
 self._linewidth = w
 set_lw = set_linewidth
+ 
+ def set_linestyle(self, ls):
+ """
+ Set the patch linestyle
 
+ ACCEPTS: ['solid' | 'dashed' | 'dashdot' | 'dotted']
+ """
+ if ls is None: ls = "solid"
+ self._linestyle = ls
+ set_ls = set_linestyle
+
 def set_fill(self, b):
 """
 Set whether to fill the patch
@@ -243,6 +261,7 @@
 else:
 gc.set_foreground(self._edgecolor)
 gc.set_linewidth(self._linewidth)
+ gc.set_linestyle(self._linestyle)
 
 gc.set_alpha(self._alpha)
 gc.set_antialiased(self._antialiased)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年06月24日 17:37:31
Revision: 5661
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5661&view=rev
Author: mdboom
Date: 2008年06月24日 10:36:44 -0700 (2008年6月24日)
Log Message:
-----------
Docstring formatting fixes.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年06月24日 17:35:57 UTC (rev 5660)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年06月24日 17:36:44 UTC (rev 5661)
@@ -153,7 +153,7 @@
 def get_linewidth(self):
 return self._linewidth
 get_lw = get_linewidth
- 
+
 def get_linestyle(self):
 return self._linestyle
 get_ls = get_linestyle
@@ -197,7 +197,7 @@
 if w is None: w = mpl.rcParams['patch.linewidth']
 self._linewidth = w
 set_lw = set_linewidth
- 
+
 def set_linestyle(self, ls):
 """
 Set the patch linestyle
@@ -645,6 +645,7 @@
 self.theta2 = theta2
 self._patch_transform = transforms.IdentityTransform()
 self._path = Path.wedge(self.theta1, self.theta2)
+ __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
 def get_path(self):
 return self._path
@@ -931,6 +932,7 @@
 self._path = Path.unit_circle()
 self._patch_transform = transforms.IdentityTransform()
 self._recompute_transform()
+ __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
 def _recompute_transform(self):
 center = (self.convert_xunits(self.center[0]),
@@ -1037,6 +1039,7 @@
 
 self.theta1 = theta1
 self.theta2 = theta2
+ __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
 def draw(self, renderer):
 """
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2008年06月24日 17:44:27
Revision: 5663
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5663&view=rev
Author: jdh2358
Date: 2008年06月24日 10:44:09 -0700 (2008年6月24日)
Log Message:
-----------
fixed rectangle get linestyle bug
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2008年06月24日 17:41:08 UTC (rev 5662)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2008年06月24日 17:44:09 UTC (rev 5663)
@@ -121,7 +121,7 @@
 self.set_fill(other.get_fill())
 self.set_hatch(other.get_hatch())
 self.set_linewidth(other.get_linewidth())
- self.set_linestyle(other.get_linestyle)
+ self.set_linestyle(other.get_linestyle())
 self.set_transform(other.get_data_transform())
 self.set_figure(other.get_figure())
 self.set_alpha(other.get_alpha())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /