@@ -273,3 +273,46 @@ def test_axis_mirror_mixed_configurations():
273273
274274 assert plotly_fig .layout .xaxis .mirror == "ticks"
275275 assert plotly_fig .layout .yaxis .mirror == False
276+
277+
278+ def test_axis_showline_tied_to_main_spine ():
279+ """Test that showline follows the main-side spine (bottom for x, left for y)."""
280+ fig , ax = plt .subplots ()
281+ ax .plot ([0 , 1 ], [0 , 1 ])
282+
283+ # Hide the mirror-side spines only
284+ ax .spines ["top" ].set_visible (False )
285+ ax .spines ["right" ].set_visible (False )
286+
287+ plotly_fig = tls .mpl_to_plotly (fig )
288+
289+ assert plotly_fig .layout .xaxis .showline == True
290+ assert plotly_fig .layout .yaxis .showline == True
291+
292+
293+ def test_axis_showline_hidden_when_main_spine_hidden ():
294+ """Test that showline is False when the main-side spine is hidden."""
295+ fig , ax = plt .subplots ()
296+ ax .plot ([0 , 1 ], [0 , 1 ])
297+
298+ # Hide the main-side spines but keep the mirror-side ones
299+ ax .spines ["bottom" ].set_visible (False )
300+ ax .spines ["left" ].set_visible (False )
301+
302+ plotly_fig = tls .mpl_to_plotly (fig )
303+
304+ assert plotly_fig .layout .xaxis .showline == False
305+ assert plotly_fig .layout .yaxis .showline == False
306+
307+
308+ def test_ticks_hidden_when_mpl_main_ticks_hidden ():
309+ """Test that tick markers are hidden when the mpl main-side ticks are hidden."""
310+ fig , ax = plt .subplots ()
311+ ax .plot ([0 , 1 ], [0 , 1 ])
312+
313+ ax .tick_params (top = False , bottom = False , left = False , right = False )
314+
315+ plotly_fig = tls .mpl_to_plotly (fig )
316+
317+ assert plotly_fig .layout .xaxis .ticks == ""
318+ assert plotly_fig .layout .yaxis .ticks == ""
0 commit comments