| 1 | Index: lib/matplotlib/lines.py
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | RCS file: /cvsroot/matplotlib/matplotlib/lib/matplotlib/lines.py,v
|
|---|
| 4 | retrieving revision 1.36
|
|---|
| 5 | diff -r1.36 lines.py
|
|---|
| 6 | 15c15,16
|
|---|
| 7 | < compress, zeros, concatenate, cumsum
|
|---|
| 8 | ---
|
|---|
| 9 | > compress, zeros, concatenate, cumsum, \
|
|---|
| 10 | > matrixmultiply
|
|---|
| 11 | 24a26
|
|---|
| 12 | > import math
|
|---|
| 13 | 30a33
|
|---|
| 14 | > 'a':1,
|
|---|
| 15 | 120a124
|
|---|
| 16 | > 'a' : '_draw_arrow_head',
|
|---|
| 17 | 970a975,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)
|
|---|