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

Function test_polar_coord_annotations

lib/matplotlib/tests/test_polar.py:51–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49@image_comparison(['polar_coords.png'], style='default', remove_text=True,
50 tol=0.013 if sys.platform == 'darwin' else 0)
51def test_polar_coord_annotations():
52 # You can also use polar notation on a cartesian axes. Here the native
53 # coordinate system ('data') is cartesian, so you need to specify the
54 # xycoords and textcoords as 'polar' if you want to use (theta, radius).
55 el = mpl.patches.Ellipse((0, 0), 10, 20, facecolor='r', alpha=0.5)
56
57 fig = plt.figure()
58 ax = fig.add_subplot(aspect='equal')
59
60 ax.add_artist(el)
61 el.set_clip_box(ax.bbox)
62
63 ax.annotate('the top',
64 xy=(np.pi/2., 10.), # theta, radius
65 xytext=(np.pi/3, 20.), # theta, radius
66 xycoords='polar',
67 textcoords='polar',
68 arrowprops=dict(facecolor='black', shrink=0.05),
69 horizontalalignment='left',
70 verticalalignment='baseline',
71 clip_on=True, # clip to the axes bounding box
72 )
73
74 ax.set_xlim(-20, 20)
75 ax.set_ylim(-20, 20)
76
77
78@image_comparison(['polar_alignment.png'], style='mpl20')

Callers

nothing calls this directly

Calls 7

figureMethod · 0.80
add_subplotMethod · 0.80
annotateMethod · 0.80
add_artistMethod · 0.45
set_clip_boxMethod · 0.45
set_xlimMethod · 0.45
set_ylimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…