Skip to content

Commit b30b155

Browse files
committed
Use plt.subplots for safety.
And no longer need copy.deepcopy.
1 parent 99a2e97 commit b30b155

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Diff for: src/napari_matplotlib/tests/test_theme.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from copy import deepcopy
2-
31
import napari
42
import numpy as np
53
import pytest
@@ -110,11 +108,13 @@ def test_no_theme_side_effects(make_napari_viewer):
110108

111109
# some plotting unrelated to napari-matplotlib
112110
image = np.random.random((3, 3))
113-
plt.imshow(image)
114-
plt.xlabel("something unrelated to napari (x)")
115-
plt.ylabel("something unrelated to napari (y)")
116-
plt.title("this plot style should not change with napari styles or themes")
117-
plt.tight_layout()
118-
unrelated_figure = plt.gcf()
119-
120-
return deepcopy(unrelated_figure)
111+
unrelated_figure, ax = plt.subplots()
112+
ax.imshow(image)
113+
ax.set_xlabel("something unrelated to napari (x)")
114+
ax.set_ylabel("something unrelated to napari (y)")
115+
ax.set_title(
116+
"this plot style should not change with napari styles or themes"
117+
)
118+
unrelated_figure.tight_layout()
119+
120+
return unrelated_figure

0 commit comments

Comments
 (0)