From db25d3b0133215c6f465a05e47b3da11be8b77a0 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 3e9ae9bb76..90f73bff36 100644 --- a/plotly/matplotlylib/tests/test_renderer.py +++ b/plotly/matplotlylib/tests/test_renderer.py @@ -27,6 +27,22 @@ def test_native_legend_enabled_when_matplotlib_legend_present(): assert plotly_fig.data[1].name == "Line 2" +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" + + def test_no_fake_legend_shapes_with_native_legend(): """Test that fake legend shapes are not created when using native legend.""" fig, ax = plt.subplots()