Skip to content

Commit 5230176

Browse files
committed
Add tests for stem3d.
These are somewhat like the original tests in matplotlib#6271, but consolidated into a single image, and testing more properties.
1 parent 3693b31 commit 5230176

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,35 @@ def test_errorbar3d():
12031203
ax.legend()
12041204

12051205

1206+
@image_comparison(['stem3d.png'], style='mpl20')
1207+
def test_stem3d():
1208+
fig, axs = plt.subplots(2, 3, figsize=(8, 6),
1209+
constrained_layout=True,
1210+
subplot_kw={'projection': '3d'})
1211+
1212+
theta = np.linspace(0, 2*np.pi)
1213+
x = np.cos(theta - np.pi/2)
1214+
y = np.sin(theta - np.pi/2)
1215+
z = theta
1216+
1217+
for ax, zdir in zip(axs[0], ['x', 'y', 'z']):
1218+
ax.stem(x, y, z, orientation=zdir)
1219+
ax.set_title(f'orientation={zdir}')
1220+
1221+
x = np.linspace(-np.pi/2, np.pi/2, 20)
1222+
y = np.ones_like(x)
1223+
z = np.cos(x)
1224+
1225+
for ax, zdir in zip(axs[1], ['x', 'y', 'z']):
1226+
markerline, stemlines, baseline = ax.stem(
1227+
x, y, z,
1228+
linefmt='C4-.', markerfmt='C1D', basefmt='C2',
1229+
orientation=zdir)
1230+
ax.set_title(f'orientation={zdir}')
1231+
markerline.set(markerfacecolor='none', markeredgewidth=2)
1232+
baseline.set_linewidth(3)
1233+
1234+
12061235
@image_comparison(["equal_box_aspect.png"], style="mpl20")
12071236
def test_equal_box_aspect():
12081237
from itertools import product, combinations

0 commit comments

Comments
 (0)