@@ -868,7 +868,21 @@ def cla(self):
868868 self .xaxis .minor = self ._sharex .xaxis .minor
869869 x0 , x1 = self ._sharex .get_xlim ()
870870 self .set_xlim (x0 , x1 , emit = False , auto = None )
871+
872+ # Save the current formatter/locator so we don't lose it
873+ majf = self ._sharex .xaxis .get_major_formatter ()
874+ minf = self ._sharex .xaxis .get_minor_formatter ()
875+ majl = self ._sharex .xaxis .get_major_locator ()
876+ minl = self ._sharex .xaxis .get_minor_locator ()
877+
878+ # This overwrites the current formatter/locator
871879 self .xaxis .set_scale (self ._sharex .xaxis .get_scale ())
880+
881+ # Reset the formatter/locator
882+ self .xaxis .set_major_formatter (majf )
883+ self .xaxis .set_minor_formatter (minf )
884+ self .xaxis .set_major_locator (majl )
885+ self .xaxis .set_minor_locator (minl )
872886 else :
873887 self .xaxis .set_scale ('linear' )
874888
@@ -877,7 +891,21 @@ def cla(self):
877891 self .yaxis .minor = self ._sharey .yaxis .minor
878892 y0 , y1 = self ._sharey .get_ylim ()
879893 self .set_ylim (y0 , y1 , emit = False , auto = None )
894+
895+ # Save the current formatter/locator so we don't lose it
896+ majf = self ._sharey .yaxis .get_major_formatter ()
897+ minf = self ._sharey .yaxis .get_minor_formatter ()
898+ majl = self ._sharey .yaxis .get_major_locator ()
899+ minl = self ._sharey .yaxis .get_minor_locator ()
900+
901+ # This overwrites the current formatter/locator
880902 self .yaxis .set_scale (self ._sharey .yaxis .get_scale ())
903+
904+ # Reset the formatter/locator
905+ self .yaxis .set_major_formatter (majf )
906+ self .yaxis .set_minor_formatter (minf )
907+ self .yaxis .set_major_locator (majl )
908+ self .yaxis .set_minor_locator (minl )
881909 else :
882910 self .yaxis .set_scale ('linear' )
883911
0 commit comments