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

Skip to content

Commit 7d76522

Browse files
committed
TST: add test for first draw having correct annotation position
1 parent 199ce12 commit 7d76522

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
@@ -5815,3 +5815,20 @@ class DummySubplot(matplotlib.axes.SubplotBase, Dummy):
58155815
FactoryDummySubplot = matplotlib.axes.subplot_class_factory(Dummy)
58165816

58175817
assert DummySubplot is FactoryDummySubplot
5818+
5819+
5820+
@image_comparison(baseline_images=['annotate_across_transforms'],
5821+
style='mpl20', extensions=['png'], remove_text=True)
5822+
def test_annotate_across_transforms():
5823+
x = np.linspace(0, 10, 200)
5824+
y = np.exp(-x) * np.sin(x)
5825+
5826+
fig, ax = plt.subplots(figsize=(3.39, 3))
5827+
ax.plot(x, y)
5828+
axins = ax.inset_axes([0.4, 0.5, 0.3, 0.3])
5829+
axins.set_aspect(0.2)
5830+
axins.xaxis.set_visible(False)
5831+
axins.yaxis.set_visible(False)
5832+
ax.annotate("", xy=(x[150], y[150]), xycoords=ax.transData,
5833+
xytext=(1, 0), textcoords=axins.transAxes,
5834+
arrowprops=dict(arrowstyle="->"))

0 commit comments

Comments
 (0)