Permalink
Browse files

Fix overwrite of the minor formatters and locaters

  • Loading branch information...
1 parent 62dc662 commit c240932c586859825b507686a016d6a39e1ee0b7 @dmcdougall committed Sep 1, 2012
Showing with 22 additions and 10 deletions.
  1. +22 −10 lib/matplotlib/axes.py
View
@@ -853,14 +853,20 @@ def cla(self):
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()
+ # Save the current formatter/locator so we don't lose it
+ majf = self._sharex.xaxis.get_major_formatter()
+ minf = self._sharex.xaxis.get_minor_formatter()
+ majl = self._sharex.xaxis.get_major_locator()
+ minl = self._sharex.xaxis.get_minor_locator()
- # This overwrites the current formatter
+ # This overwrites the current formatter/locator
self.xaxis.set_scale(self._sharex.xaxis.get_scale())
- # Reset the formatter
- self.xaxis.set_major_formatter(frmt)
+ # Reset the formatter/locator
+ self.xaxis.set_major_formatter(majf)
+ self.xaxis.set_minor_formatter(minf)
+ self.xaxis.set_major_locator(majl)
+ self.xaxis.set_minor_locator(minl)
else:
self.xaxis.set_scale('linear')
@@ -870,14 +876,20 @@ def cla(self):
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()
+ # Save the current formatter/locator so we don't lose it
+ majf = self._sharey.yaxis.get_major_formatter()
+ minf = self._sharey.yaxis.get_minor_formatter()
+ majl = self._sharey.yaxis.get_major_locator()
+ minl = self._sharey.yaxis.get_minor_locator()
- # This overwrites the current formatter
+ # This overwrites the current formatter/locator
self.yaxis.set_scale(self._sharey.yaxis.get_scale())
- # Reset the formatter
- self.yaxis.set_major_formatter(frmt)
+ # Reset the formatter/locator
+ self.yaxis.set_major_formatter(majf)
+ self.yaxis.set_minor_formatter(minf)
+ self.yaxis.set_major_locator(majl)
+ self.yaxis.set_minor_locator(minl)
else:
self.yaxis.set_scale('linear')

0 comments on commit c240932

Please sign in to comment.