8000 BUG: in ScalarFormatter, handle two identical locations; closes #4761 · matplotlib/matplotlib@c0803f0 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c0803f0

Browse files
committed
BUG: in ScalarFormatter, handle two identical locations; closes #4761
1 parent 6e4e3a2 commit c0803f0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/matplotlib/ticker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ def _set_format(self, vmin, vmax):
585585
_locs = self.locs
586586
locs = (np.asarray(_locs) - self.offset) / 10. ** self.orderOfMagnitude
587587
loc_range = np.ptp(locs)
588+
# Curvilinear coordinates can yield two identical points.
589+
if loc_range == 0:
590+
loc_range = np.max(np.abs(locs))
591+
# Both points might be zero.
592+
if loc_range == 0:
593+
loc_range = 1
588594
if len(self.locs) < 2:
589595
# We needed the end points only for the loc_range calculation.
590596
locs = locs[:-2]

0 commit comments

Comments
 (0)
0