@@ -44,7 +44,10 @@ def test_legend_disabled_when_no_matplotlib_legend():
44
44
45
45
# Should not have showlegend explicitly set to True
46
46
# (Plotly's default behavior when no legend elements exist)
47
- assert not hasattr (plotly_fig .layout , 'showlegend' ) or plotly_fig .layout .showlegend != True
47
+ assert (
48
+ not hasattr (plotly_fig .layout , "showlegend" )
49
+ or plotly_fig .layout .showlegend != True
50
+ )
48
51
49
52
50
53
def test_legend_disabled_when_matplotlib_legend_not_visible ():
@@ -57,15 +60,18 @@ def test_legend_disabled_when_matplotlib_legend_not_visible():
57
60
plotly_fig = tls .mpl_to_plotly (fig )
58
61
59
62
# Should not enable legend when matplotlib legend is hidden
60
- assert not hasattr (plotly_fig .layout , 'showlegend' ) or plotly_fig .layout .showlegend != True
63
+ assert (
64
+ not hasattr (plotly_fig .layout , "showlegend" )
65
+ or plotly_fig .layout .showlegend != True
66
+ )
61
67
62
68
63
69
def test_multiple_traces_native_legend ():
64
70
"""Test native legend works with multiple traces of different types."""
65
71
fig , ax = plt .subplots ()
66
- ax .plot ([0 , 1 , 2 ], [0 , 1 , 0 ], '-' , label = "Line" )
67
- ax .plot ([0 , 1 , 2 ], [1 , 0 , 1 ], 'o' , label = "Markers" )
68
- ax .plot ([0 , 1 , 2 ], [0.5 , 0.5 , 0.5 ], 's-' , label = "Line+Markers" )
72
+ ax .plot ([0 , 1 , 2 ], [0 , 1 , 0 ], "-" , label = "Line" )
73
+ ax .plot ([0 , 1 , 2 ], [1 , 0 , 1 ], "o" , label = "Markers" )
74
+ ax .plot ([0 , 1 , 2 ], [0.5 , 0.5 , 0.5 ], "s-" , label = "Line+Markers" )
69
75
ax .legend ()
70
76
71
77
plotly_fig = tls .mpl_to_plotly (fig )
0 commit comments