Skip to content

Commit bd7697b

Browse files
Add lines+markers legend test
1 parent a5974ce commit bd7697b

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
@@ -199,3 +199,19 @@ def test_filled_path_collection_date_xaxis():
199199
filled = [t for t in plotly_fig.data if t.fill == "toself"]
200200
assert len(filled) >= 1
201201
assert all(isinstance(x, str) for x in filled[0].x)
202+
203+
204+
def test_lines_markers_legend_plot():
205+
x = [0, 1]
206+
y = [0, 1]
207+
label = "label"
208+
plt.figure()
209+
plt.plot(x, y, "o-", label=label)
210+
plt.legend()
211+
212+
plotly_fig = tls.mpl_to_plotly(plt.gcf())
213+
214+
assert plotly_fig.data[0].mode == "lines+markers"
215+
assert plotly_fig.data[0].x == tuple(x)
216+
assert plotly_fig.data[0].y == tuple(y)
217+
assert plotly_fig.data[0].name == "label"

0 commit comments

Comments
 (0)