8000 TST: add test for first draw having correct annotation position · matplotlib/matplotlib@cbbaca2 · GitHub
[go: up one dir, main page]

Skip to content

Commit cbbaca2

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

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5789,6 +5789,7 @@ def test_zoom_inset():
57895789
xx, rtol=1e-4)
57905790

57915791

5792+
57925793
def test_spines_properbbox_after_zoom():
57935794
fig, ax = plt.subplots()
57945795
bb = ax.spines['bottom'].get_window_extent(fig.canvas.get_renderer())
@@ -5815,3 +5816,20 @@ class DummySubplot(matplotlib.axes.SubplotBase, Dummy):
58155816
FactoryDummySubplot = matplotlib.axes.subplot_class_factory(Dummy)
58165817

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

0 commit comments

Comments
 (0)
0