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

Skip to content

Commit 887c9d2

Browse files
committed
TST: add test for first draw having correct annotation position
1 parent b764116 commit 887c9d2

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5792,3 +5792,20 @@ def test_spines_properbbox_after_zoom():
57925792
None, False, False)
57935793
bb2 = ax.spines['bottom'].get_window_extent(fig.canvas.get_renderer())
57945794
np.testing.assert_allclose(bb.get_points(), bb2.get_points(), rtol=1e-6)
5795+
5796+
5797+
@image_comparison(baseline_images=['annotate_across_transforms'],
5798+
style='mpl20', extensions=['png'], remove_text=True)
5799+
def test_annotate_across_transforms():
5800+
x = np.linspace(0, 10, 200)
5801+
y = np.exp(-x) * np.sin(x)
5802+
5803+
fig, ax = plt.subplots(figsize=(3.39, 3))
5804+
ax.plot(x, y)
5805+
axins = ax.inset_axes([0.4, 0.5, 0.3, 0.3])
5806+
axins.set_aspect(0.2)
5807+
axins.xaxis.set_visible(False)
5808+
axins.yaxis.set_visible(False)
5809+
ax.annotate("", xy=(x[150], y[150]), xycoords=ax.transData,
5810+
xytext=(1, 0), textcoords=axins.transAxes,
5811+
arrowprops=dict(arrowstyle="->"))

0 commit comments

Comments
 (0)