From 7f5b5edff6992b56064e865df373c70094e7b043 Mon Sep 17 00:00:00 2001 From: robertoffmoura Date: Sun, 15 Jun 2025 14:40:37 +0100 Subject: [PATCH 1/2] Fix issue when converting matplotlib lines+markers legend to plotly --- 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 0d63e4815b..30690cf2ca 100644 --- a/plotly/matplotlylib/tests/test_renderer.py +++ b/plotly/matplotlylib/tests/test_renderer.py @@ -84,3 +84,19 @@ def test_multiple_traces_native_legend(): assert plotly_fig.data[0].mode == "lines" assert plotly_fig.data[1].mode == "markers" assert plotly_fig.data[2].mode == "lines+markers" + + +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" From 719248aab76e28b5dcd906ec3f6d5abda89bf9ac Mon Sep 17 00:00:00 2001 From: robertoffmoura Date: Tue, 12 Aug 2025 10:00:46 +0100 Subject: [PATCH 2/2] Run ruff format --- plotly/matplotlylib/tests/test_renderer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plotly/matplotlylib/tests/test_renderer.py b/plotly/matplotlylib/tests/test_renderer.py index 30690cf2ca..79252051af 100644 --- a/plotly/matplotlylib/tests/test_renderer.py +++ b/plotly/matplotlylib/tests/test_renderer.py @@ -86,6 +86,7 @@ def test_multiple_traces_native_legend(): assert plotly_fig.data[2].mode == "lines+markers" + def test_lines_markers_legend_plot(): x = [0, 1] y = [0, 1]