File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -3924,6 +3924,7 @@ def twinx(self):
39243924 ax2 .yaxis .tick_right ()
39253925 ax2 .yaxis .set_label_position ('right' )
39263926 ax2 .yaxis .set_offset_position ('right' )
3927+ ax2 .set_autoscalex_on (self .get_autoscalex_on ())
39273928 self .yaxis .tick_left ()
39283929 ax2 .xaxis .set_visible (False )
39293930 ax2 .patch .set_visible (False )
@@ -3952,6 +3953,7 @@ def twiny(self):
39523953 ax2 = self ._make_twin_axes (sharey = self )
39533954 ax2 .xaxis .tick_top ()
39543955 ax2 .xaxis .set_label_position ('top' )
3956+ ax2 .set_autoscaley_on (self .get_autoscaley_on ())
39553957 self .xaxis .tick_bottom ()
39563958 ax2 .yaxis .set_visible (False )
39573959 ax2 .patch .set_visible (False )
Original file line number Diff line number Diff line change @@ -145,6 +145,24 @@ def test_twinx_cla():
145145 assert ax .yaxis .get_visible ()
146146
147147
148+ @cleanup
149+ def test_twin_inherit_autoscale ():
150+ fig , ax = plt .subplots ()
151+ ax_x_on = ax .twinx ()
152+ ax .set_autoscalex_on (False )
153+ ax_x_off = ax .twinx ()
154+
155+ assert ax_x_on .get_autoscalex_on ()
156+ assert not ax_x_off .get_autoscalex_on ()
157+
158+ ax_y_on = ax .twiny ()
159+ ax .set_autoscaley_on (False )
160+ ax_y_off = ax .twiny ()
161+
162+ assert ax_y_on .get_autoscaley_on ()
163+ assert not ax_y_off .get_autoscaley_on ()
164+
165+
148166@image_comparison (baseline_images = ["minorticks_on_rcParams_both" ], extensions = ['png' ])
149167def test_minorticks_on_rcParams_both ():
150168 fig = plt .figure ()
You can’t perform that action at this time.
0 commit comments