Ejemplo n.º 1
0
 def _extend_path(self, path, mutation_size=10):
     """
     Extend the path to make a room for drawing arrow.
     """
     from matplotlib.bezier import get_cos_sin
     x0, y0 = path.vertices[-2]
     x1, y1 = path.vertices[-1]
     cost, sint = get_cos_sin(x0, y0, x1, y1)
     d = mutation_size * 1.
     x2, y2 = x1 + cost*d, y1+sint*d
     if path.codes is None:
         _path = Path(np.concatenate([path.vertices, [[x2, y2]]]))
     else:
         _path = Path(np.concatenate([path.vertices, [[x2, y2]]]),
                      np.concatenate([path.codes, [Path.LINETO]]))
     return _path
Ejemplo n.º 2
0
        def _extend_path(self, path, mutation_size=10):
            """
            Extend the path to make a room for drawing arrow.
            """
            from matplotlib.bezier import get_cos_sin

            x0, y0 = path.vertices[-2]
            x1, y1 = path.vertices[-1]
            cost, sint = get_cos_sin(x0, y0, x1, y1)

            d = mutation_size * 1.
            x2, y2 = x1 + cost * d, y1 + sint * d

            if path.codes is None:
                _path = Path(np.concatenate([path.vertices, [[x2, y2]]]))
            else:
                _path = Path(np.concatenate([path.vertices, [[x2, y2]]]),
                             np.concatenate([path.codes, [Path.LINETO]]))

            return _path