From bd7697bcce8a199f4f9b25ea161fa489d1426e48 Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sun, 15 Jun 2025 14:40:37 +0100 Subject: [PATCH] Add lines+markers legend test --- plotly/matplotlylib/tests/test_renderer.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plotly/matplotlylib/tests/test_renderer.py b/plotly/matplotlylib/tests/test_renderer.py index f56d830917..adf87ac01d 100644 --- a/plotly/matplotlylib/tests/test_renderer.py +++ b/plotly/matplotlylib/tests/test_renderer.py @@ -199,3 +199,19 @@ def test_filled_path_collection_date_xaxis(): filled = [t for t in plotly_fig.data if t.fill == "toself"] assert len(filled) >= 1 assert all(isinstance(x, str) for x in filled[0].x) + + +def test_lines_markers_legend_plot(): + x = [0, 1] + y = [0, 1] + label = "label" + plt.figure() + plt.plot(x, y, "o-", label=label) + plt.legend() + + plotly_fig = tls.mpl_to_plotly(plt.gcf()) + + assert plotly_fig.data[0].mode == "lines+markers" + assert plotly_fig.data[0].x == tuple(x) + assert plotly_fig.data[0].y == tuple(y) + assert plotly_fig.data[0].name == "label"