Skip to content

fix the filtering of non-integer ticks in maxNlocator with *integer = True* #12087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1940,12 +1940,16 @@ def _raw_ticks(self, vmin, vmax):
_vmin = vmin - offset
_vmax = vmax - offset
raw_step = (_vmax - _vmin) / nbins
steps = self._extended_steps * scale
print("self._extended_steps = " + str(self._extended_steps))
steps = self._extended_steps

if self._integer:
print("self.interger is " + str(self._integer))
# For steps > 1, keep only integer values.
igood = (steps < 1) | (np.abs(steps - np.round(steps)) < 0.001)
igood = (steps >= 1) & (np.abs(steps - np.round(steps)) < 0.001)
steps = steps[igood]

steps = steps * scale
istep = np.nonzero(steps >= raw_step)[0][0]

# Classic round_numbers mode may require a larger step.
Expand Down