MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _get_bracket

Method _get_bracket

lib/matplotlib/patches.py:3550–3574  ·  view source on GitHub ↗
(self, x0, y0,
                         x1, y1, width, length, angle)

Source from the content-addressed store, hash-verified

3548 return vertices_arrow, codes_arrow, ddx, ddy
3549
3550 def _get_bracket(self, x0, y0,
3551 x1, y1, width, length, angle):
3552
3553 cos_t, sin_t = get_cos_sin(x1, y1, x0, y0)
3554
3555 # arrow from x0, y0 to x1, y1
3556 from matplotlib.bezier import get_normal_points
3557 x1, y1, x2, y2 = get_normal_points(x0, y0, cos_t, sin_t, width)
3558
3559 dx, dy = length * cos_t, length * sin_t
3560
3561 vertices_arrow = [(x1 + dx, y1 + dy),
3562 (x1, y1),
3563 (x2, y2),
3564 (x2 + dx, y2 + dy)]
3565 codes_arrow = [Path.MOVETO,
3566 Path.LINETO,
3567 Path.LINETO,
3568 Path.LINETO]
3569
3570 if angle:
3571 trans = transforms.Affine2D().rotate_deg_around(x0, y0, angle)
3572 vertices_arrow = trans.transform(vertices_arrow)
3573
3574 return vertices_arrow, codes_arrow
3575
3576 def transmute(self, path, mutation_size, linewidth):
3577 # docstring inherited

Callers 1

transmuteMethod · 0.95

Calls 4

get_normal_pointsFunction · 0.90
get_cos_sinFunction · 0.85
rotate_deg_aroundMethod · 0.80
transformMethod · 0.45

Tested by

no test coverage detected