Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7b4b43

Browse files
committed
TST: add test for first draw having correct annotation position
1 parent b53f410 commit e7b4b43

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5782,3 +5782,19 @@ def test_zoom_inset():
57825782
[0.8425, 0.907692]])
57835783
np.testing.assert_allclose(axin1.get_position().get_points(),
57845784
xx, rtol=1e-4)
5785+
5786+
@image_comparison(baseline_images=['annotate_across_transforms'],
5787+
style='mpl20', extensions=['png'], remove_text=True)
5788+
def test_annotate_across_transforms():
5789+
x=np.linspace(0,10,200)
5790+
y=np.exp(-x)*np.sin(x)
5791+
5792+
fig,ax = plt.subplots(figsize=(3.39,3))
5793+
ax.plot(x,y)
5794+
axins = ax.inset_axes([0.4, 0.5, 0.3, 0.3])
5795+
axins.set_aspect(0.2)
5796+
axins.xaxis.set_visible(False)
5797+
axins.yaxis.set_visible(False)
5798+
ax.annotate("",xy=(x[150],y[150]), xycoords=ax.transData,
5799+
xytext=(1, 0), textcoords=axins.transAxes,
5800+
arrowprops=dict(arrowstyle="->"))

0 commit comments

Comments
 (0)