Skip to content

Commit 7f5b5ed

Browse files
Fix issue when converting matplotlib lines+markers legend to plotly
1 parent bf29422 commit 7f5b5ed

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

plotly/matplotlylib/tests/test_renderer.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,19 @@ def test_multiple_traces_native_legend():
8484
assert plotly_fig.data[0].mode == "lines"
8585
assert plotly_fig.data[1].mode == "markers"
8686
assert plotly_fig.data[2].mode == "lines+markers"
87+
88+
89+
def test_lines_markers_legend_plot():
90+
x = [0, 1]
91+
y = [0, 1]
92+
label = "label"
93+
plt.figure()
94+
plt.plot(x, y, "o-", label=label)
95+
plt.legend()
96+
97+
plotly_fig = tls.mpl_to_plotly(plt.gcf())
98+
99+
assert plotly_fig.data[0].mode == "lines+markers"
100+
assert plotly_fig.data[0].x == tuple(x)
101+
assert plotly_fig.data[0].y == tuple(y)
102+
assert plotly_fig.data[0].name == "label"

0 commit comments

Comments
 (0)