Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix formatter reset when twin{x,y}() is called

  • Loading branch information...
commit 1ed5c9f99ab8f5e2ceb9a00dc75eae4037245da2 1 parent 3419eb8
@dmcdougall authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/matplotlib/axes.py
View
16 lib/matplotlib/axes.py
@@ -852,7 +852,15 @@ def cla(self):
self.xaxis.minor = self._sharex.xaxis.minor
x0, x1 = self._sharex.get_xlim()
self.set_xlim(x0, x1, emit=False, auto=None)
+
+ # Save the current formatter so we don't lose it
+ frmt = self._sharex.xaxis.get_major_formatter()
+
+ # This overwrites the current formatter
self.xaxis.set_scale(self._sharex.xaxis.get_scale())
+
+ # Reset the formatter
+ self.xaxis.set_major_formatter(frmt)
else:
self.xaxis.set_scale('linear')
@@ -861,7 +869,15 @@ def cla(self):
self.yaxis.minor = self._sharey.yaxis.minor
y0, y1 = self._sharey.get_ylim()
self.set_ylim(y0, y1, emit=False, auto=None)
+
+ # Save the current formatter so we don't lose it
+ frmt = self._sharey.yaxis.get_major_formatter()
+
+ # This overwrites the current formatter
self.yaxis.set_scale(self._sharey.yaxis.get_scale())
+
+ # Reset the formatter
+ self.yaxis.set_major_formatter(frmt)
else:
self.yaxis.set_scale('linear')
Please sign in to comment.
Something went wrong with that request. Please try again.