Ticket #308: patch

File patch, 1.4 KB (added by nichyoung, 19 years ago)

Simple patch

Line 
1Index: lib/matplotlib/lines.py
2===================================================================
3RCS file: /cvsroot/matplotlib/matplotlib/lib/matplotlib/lines.py,v
4retrieving revision 1.36
5diff -r1.36 lines.py
615c15,16
7< compress, zeros, concatenate, cumsum
8---
9> compress, zeros, concatenate, cumsum, \
10> matrixmultiply
1124a26
12> import math
1330a33
14> 'a':1,
15120a124
16> 'a' : '_draw_arrow_head',
17970a975,1001
18>
19> def _draw_arrow_head(self, renderer, gc, xt, yt):
20> offset = renderer.points_to_pixels(self._markersize)
21> rgbFace = self._get_rgb_face()
22> hoffset = offset / 2.0
23> poly = array([
24> [0.0, 0.0],
25> [-offset, -hoffset],
26> [-offset, hoffset],
27> ])
28> npts = len(xt) - 1
29> if npts < 1:
30> return
31> points = zip(xt, yt)
32> if self._newstyle:
33> points = self._transform.seq_xy_tups(points)
34> for i in range(npts):
35> (x1, y1), (x2, y2) = points[i], points[i+1]
36> dx = x2 - x1
37> dy = y2 - y1
38> ang = math.atan2(dy, dx)
39> cx = math.cos(ang)
40> sx = math.sin(ang)
41> M = array([[cx, sx], [-sx, cx]])
42> npoly = matrixmultiply(poly, M) + [x2, y2]
43> verts = [tuple(t) for t in npoly]
44> renderer.draw_polygon(gc, rgbFace, verts)
Back to Top