Skip to content

Fix MultipleLocator proposed by @anntzer #7123

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 1 commit into from

Conversation

rougier
Copy link
Member

@rougier rougier commented Sep 17, 2016

This is the fix proposed by @anntzer in #7122 related to a bug in MultipleLocator ticker.

locs = vmin - base + np.arange(n + 3) * base
nmin = round(self._base.ge(vmin) / base)
nmax = round(self._base.le(vmax) / base)
locs = np.arange(nmin, nmax + 1) * base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't this code be simplified to: `np.arange(vmin, vmax + base, base)? Floating point errors?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry… np.arange(self._base.ge(vmin), vmax + base, base) would be the correct solution.

Copy link
Contributor

@anntzer anntzer Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your proposal can include a value that's above vmax (eg. vmin=.5, vmax=2.5, base=1 will return [1, 2, 3]). I guess another solution that's safe against floating point errors is
np.arange(self._base.ge(vmin), self._base.le(vmax) + base / 2, base)
(the + base / 2 should take care of any fpe).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep: I am just concern about the tests that don't make sense to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a quick look and am pretty sure that the test values are wrong (i.e. they were picked to match the previous algorithm, which returns out of bounds values; they should be changed to match the new algorithm).

@NelleV
Copy link
Member

NelleV commented Sep 19, 2016

I have done a couple of tests locally, and I have to admit that the current tests seems obscure…
@pelson you wrote this test. Can you comment on this? Some ticks are outside of the bounds provided by the function: it doesn't seem the correct behavior to me.

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Sep 19, 2016
@tacaswell
Copy link
Member

I think that this ties back to the other issue with assuming all of the ticks are in view limits (#6647) and what layer of the stack is responsible for the final filtering.

@tacaswell
Copy link
Member

When this is cleared up please clean up the figure added in #7084

@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0.2 (next bug fix release) May 3, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@jklymak
Copy link
Member

jklymak commented Jul 14, 2020

This is pretty stale, so I'm assuming this change isn't urgently required by anyone, but feel free to reopen if wanted...

@jklymak jklymak closed this Jul 14, 2020
@QuLogic QuLogic added the stale label Jul 14, 2020
@story645 story645 removed this from the future releases milestone Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants