File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -3924,8 +3924,10 @@ def twinx(self):
3924
3924
ax2 .yaxis .tick_right ()
3925
3925
ax2 .yaxis .set_label_position ('right' )
3926
3926
ax2 .yaxis .set_offset_position ('right' )
3927
+ ax2 .set_autoscalex_on (self .get_autoscalex_on ())
3927
3928
self .yaxis .tick_left ()
3928
3929
ax2 .xaxis .set_visible (False )
3930
+ ax2 .set
3929
3931
ax2 .patch .set_visible (False )
3930
3932
return ax2
3931
3933
@@ -3952,6 +3954,7 @@ def twiny(self):
3952
3954
ax2 = self ._make_twin_axes (sharey = self )
3953
3955
ax2 .xaxis .tick_top ()
3954
3956
ax2 .xaxis .set_label_position ('top' )
3957
+ ax2 .set_autoscaley_on (self .get_autoscaley_on ())
3955
3958
self .xaxis .tick_bottom ()
3956
3959
ax2 .yaxis .set_visible (False )
3957
3960
ax2 .patch .set_visible (False )
Original file line number Diff line number Diff line change @@ -145,6 +145,24 @@ def test_twinx_cla():
145
145
assert ax .yaxis .get_visible ()
146
146
147
147
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
+
148
166
@image_comparison (baseline_images = ["minorticks_on_rcParams_both" ], extensions = ['png' ])
149
167
def test_minorticks_on_rcParams_both ():
150
168
fig = plt .figure ()
You can’t perform that action at this time.
0 commit comments