()
| 49 | @image_comparison(['polar_coords.png'], style='default', remove_text=True, |
| 50 | tol=0.013 if sys.platform == 'darwin' else 0) |
| 51 | def 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') |
nothing calls this directly
no test coverage detected
searching dependent graphs…