Skip to content

Commit db25d3b

Browse files
Add lines+markers legend test
1 parent 9a494ea commit db25d3b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎plotly/matplotlylib/tests/test_renderer.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ def test_native_legend_enabled_when_matplotlib_legend_present():
2727
assert plotly_fig.data[1].name == "Line 2"
2828

2929

30+
def test_lines_markers_legend_plot():
31+
x = [0, 1]
32+
y = [0, 1]
33+
label = "label"
34+
plt.figure()
35+
plt.plot(x, y, "o-", label=label)
36+
plt.legend()
37+
38+
plotly_fig = tls.mpl_to_plotly(plt.gcf())
39+
40+
assert plotly_fig.data[0].mode == "lines+markers"
41+
assert plotly_fig.data[0].x == tuple(x)
42+
assert plotly_fig.data[0].y == tuple(y)
43+
assert plotly_fig.data[0].name == "label"
44+
45+
3046
def test_no_fake_legend_shapes_with_native_legend():
3147
"""Test that fake legend shapes are not created when using native legend."""
3248
fig, ax = plt.subplots()

0 commit comments

Comments
 (0)