Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b11b32c

Browse files
Update lib/matplotlib/ticker.py
Co-authored-by: Tim Hoffmann <[email protected]>
1 parent 5adc3f7 commit b11b32c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/matplotlib/ticker.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,10 +1767,11 @@ def __call__(self):
17671767
return self.tick_values(dmin, dmax)
17681768

17691769
def tick_values(self, vmin, vmax):
1770-
ticks = np.arange(vmin + self.offset, vmax + 1, self._base)
1771-
# Filter out ticks that exceed vmax to avoid off-by-one errors
1772-
ticks = ticks[ticks <= vmax]
1773-
return self.raise_if_exceeds(ticks)
1770+
# We want tick values in the closed interval [vmin, vmax].
1771+
# Since np.arange(start, stop) returns values in the semi-open interval
1772+
# [start, stop), we add a minimal offset so that stop = vmax + eps
1773+
tick_values = np.arange(vmin + self.offset, vmax + 1e-12, self._base)
1774+
return self.raise_if_exceeds(tick_values)
17741775

17751776

17761777
class FixedLocator(Locator):

0 commit comments

Comments
 (0)