Skip to content

Commit 7f9e95e

Browse files
Add lines+markers legend test
1 parent d3105d4 commit 7f9e95e

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
@@ -22,6 +22,22 @@ def test_native_legend_enabled_when_matplotlib_legend_present():
2222
assert plotly_fig.data[1].name == "Line 2"
2323

2424

25+
def test_lines_markers_legend_plot():
26+
x = [0, 1]
27+
y = [0, 1]
28+
label = "label"
29+
plt.figure()
30+
plt.plot(x, y, "o-", label=label)
31+
plt.legend()
32+
33+
plotly_fig = tls.mpl_to_plotly(plt.gcf())
34+
35+
assert plotly_fig.data[0].mode == "lines+markers"
36+
assert plotly_fig.data[0].x == tuple(x)
37+
assert plotly_fig.data[0].y == tuple(y)
38+
assert plotly_fig.data[0].name == "label"
39+
40+
2541
def test_no_fake_legend_shapes_with_native_legend():
2642
"""Test that fake legend shapes are not created when using native legend."""
2743
fig, ax = plt.subplots()

0 commit comments

Comments
 (0)