Skip to content

Commit

Permalink
BUG: in ScalarFormatter, handle two identical locations; closes #4761
Browse files Browse the repository at this point in the history
  • Loading branch information
efiring committed Aug 25, 2015
1 parent 6e4e3a2 commit c0803f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/matplotlib/ticker.py
Expand Up @@ -585,6 +585,12 @@ def _set_format(self, vmin, vmax):
_locs = self.locs
locs = (np.asarray(_locs) - self.offset) / 10. ** self.orderOfMagnitude
loc_range = np.ptp(locs)
# Curvilinear coordinates can yield two identical points.
if loc_range == 0:
loc_range = np.max(np.abs(locs))
# Both points might be zero.
if loc_range == 0:
loc_range = 1
if len(self.locs) < 2:
# We needed the end points only for the loc_range calculation.
locs = locs[:-2]
Expand Down

0 comments on commit c0803f0

Please sign in to comment.