Skip to content

Commit 59b629c

Browse files
committed
Stabilize outer align mpl test
1 parent f194f0e commit 59b629c

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

ultraplot/tests/test_colorbar.py

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -104,36 +104,41 @@ def test_outer_align():
104104
"""
105105
Test various align options.
106106
"""
107-
fig, ax = uplt.subplots()
108-
ax.plot(np.empty((0, 4)), labels=list("abcd"))
109-
ax.legend(loc="bottom", align="right", ncol=2)
110-
ax.legend(loc="left", align="bottom", ncol=1)
111-
ax.colorbar(
112-
"magma",
113-
loc="top",
114-
ticklen=0,
115-
tickloc="bottom",
116-
align="left",
117-
shrink=0.5,
118-
label="Title",
119-
extend="both",
120-
labelloc="top",
121-
labelweight="bold",
122-
)
123-
ax.colorbar(
124-
"magma",
125-
loc="r",
126-
align="top",
127-
shrink=0.5,
128-
label="label",
129-
extend="both",
130-
labelrotation=90,
131-
)
132-
ax.colorbar(
133-
"magma", loc="right", extend="both", label="test extensions", labelrotation=90
134-
)
135-
fig.suptitle("Align demo", va="bottom")
136-
return fig
107+
with uplt.rc.context({"font.family": ["DejaVu Sans", "sans-serif"]}):
108+
fig, ax = uplt.subplots(figsize=(4, 4), dpi=100)
109+
ax.plot(np.empty((0, 4)), labels=list("abcd"))
110+
ax.legend(loc="bottom", align="right", ncol=2)
111+
ax.legend(loc="left", align="bottom", ncol=1)
112+
ax.colorbar(
113+
"magma",
114+
loc="top",
115+
ticklen=0,
116+
tickloc="bottom",
117+
align="left",
118+
shrink=0.5,
119+
label="Title",
120+
extend="both",
121+
labelloc="top",
122+
labelweight="bold",
123+
)
124+
ax.colorbar(
125+
"magma",
126+
loc="r",
127+
align="top",
128+
shrink=0.5,
129+
label="label",
130+
extend="both",
131+
labelrotation=90,
132+
)
133+
ax.colorbar(
134+
"magma",
135+
loc="right",
136+
extend="both",
137+
label="test extensions",
138+
labelrotation=90,
139+
)
140+
fig.suptitle("Align demo", va="bottom")
141+
return fig
137142

138143

139144
@pytest.mark.mpl_image_compare

0 commit comments

Comments
 (0)