Skip to content

Commit

Permalink
Modifications to MultipleLocator and LogLocator, so that the locators…
Browse files Browse the repository at this point in the history
… will

give locations one past what they really need to.  This is necessary, because
in situations where round off error matters, we want the locator to offer
more that it really thinks it needs to.  The clipping of ticks still takes
place in the Axis class, so it's perfectly fine to add more locs than necessary.

In fact, matplotlib relies on the clipping behavior in the Axis class already
to not draw ticks outside of the limits of the axis.
  • Loading branch information
Daniel Hyams committed Jan 20, 2013
1 parent 255f213 commit 4c0f3f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/matplotlib/ticker.py
Expand Up @@ -1165,7 +1165,7 @@ def tick_values(self, vmin, vmax):
vmin = self._base.ge(vmin)
base = self._base.get_base()
n = (vmax - vmin + 0.001 * base) // base
locs = vmin + np.arange(n + 1) * base
locs = vmin-base + np.arange(n + 3) * base
return self.raise_if_exceeds(locs)

def view_limits(self, dmin, dmax):
Expand Down Expand Up @@ -1450,8 +1450,8 @@ def tick_values(self, vmin, vmax):
while numdec / stride + 1 > self.numticks:
stride += 1

decades = np.arange(math.floor(vmin),
math.ceil(vmax) + stride, stride)
decades = np.arange(math.floor(vmin)-1.0,
math.ceil(vmax) + 1.0 + stride, stride)
if hasattr(self, '_transform'):
ticklocs = self._transform.inverted().transform(decades)
if len(subs) > 1 or (len(subs == 1) and subs[0] != 1.0):
Expand Down

0 comments on commit 4c0f3f3

Please sign in to comment.