@@ -89,7 +89,6 @@ def test_multiple_traces_native_legend():
8989 assert plotly_fig .data [2 ].mode == "lines+markers"
9090
9191
92-
9392def test_axis_mirror_with_spines_and_ticks ():
9493 """Test that mirror=True when both spines and ticks are visible on both sides."""
9594 fig , ax = plt .subplots ()
@@ -164,6 +163,49 @@ def test_axis_mirror_mixed_configurations():
164163 assert plotly_fig .layout .yaxis .mirror == False
165164
166165
166+ def test_axis_showline_tied_to_main_spine ():
167+ """Test that showline follows the main-side spine (bottom for x, left for y)."""
168+ fig , ax = plt .subplots ()
169+ ax .plot ([0 , 1 ], [0 , 1 ])
170+
171+ # Hide the mirror-side spines only
172+ ax .spines ["top" ].set_visible (False )
173+ ax .spines ["right" ].set_visible (False )
174+
175+ plotly_fig = tls .mpl_to_plotly (fig )
176+
177+ assert plotly_fig .layout .xaxis .showline == True
178+ assert plotly_fig .layout .yaxis .showline == True
179+
180+
181+ def test_axis_showline_hidden_when_main_spine_hidden ():
182+ """Test that showline is False when the main-side spine is hidden."""
183+ fig , ax = plt .subplots ()
184+ ax .plot ([0 , 1 ], [0 , 1 ])
185+
186+ # Hide the main-side spines but keep the mirror-side ones
187+ ax .spines ["bottom" ].set_visible (False )
188+ ax .spines ["left" ].set_visible (False )
189+
190+ plotly_fig = tls .mpl_to_plotly (fig )
191+
192+ assert plotly_fig .layout .xaxis .showline == False
193+ assert plotly_fig .layout .yaxis .showline == False
194+
195+
196+ def test_ticks_hidden_when_mpl_main_ticks_hidden ():
197+ """Test that tick markers are hidden when the mpl main-side ticks are hidden."""
198+ fig , ax = plt .subplots ()
199+ ax .plot ([0 , 1 ], [0 , 1 ])
200+
201+ ax .tick_params (top = False , bottom = False , left = False , right = False )
202+
203+ plotly_fig = tls .mpl_to_plotly (fig )
204+
205+ assert plotly_fig .layout .xaxis .ticks == ""
206+ assert plotly_fig .layout .yaxis .ticks == ""
207+
208+
167209def test_violinplot_bodies_are_filled_polygons ():
168210 fig , ax = plt .subplots ()
169211 ax .violinplot (np .random .randn (100 , 3 ))
0 commit comments