Skip to content
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

auto_ticks raises ValueError for some inputs #824

Closed
mdickinson opened this issue Jan 21, 2022 · 5 comments
Closed

auto_ticks raises ValueError for some inputs #824

mdickinson opened this issue Jan 21, 2022 · 5 comments

Comments

@mdickinson
Copy link
Member

We're running into the following problem with auto_ticks on a downstream project, leading to a blank plot window.

Python 3.6.13 |Enthought, Inc. (x86_64)| (default, Apr 13 2021, 19:22:11) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from chaco.ticks import auto_ticks
>>> auto_ticks(657022.2328451854, 577935.6054180114, 657022.2328451854, 577935.6054180114, "auto", use_endpoints=False)
/Users/mdickinson/Enthought/ETS/chaco/chaco/ticks.py:392: RuntimeWarning: invalid value encountered in log10
  magnitudes = 10.0 ** floor(log10(candidate_intervals))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mdickinson/Enthought/ETS/chaco/chaco/ticks.py", line 308, in auto_ticks
    ticks = arange(start, end + (tick_interval / 2.0), tick_interval)
ValueError: arange: cannot compute length

Expected behaviour: a list of tick locations is returned (possibly the empty list).

@mdickinson
Copy link
Member Author

Note that we have data_low > data_high for the inputs to auto_ticks above. While this may be indicative of an error in the calling code, I think it would make sense to also make auto_ticks robust for this kind of input.

@corranwebster
Copy link
Contributor

Not a fix, but a work-around: if you can create a replacement without the error, it is straightforward to create a new tick generator around the replacement and use that in the downstream app.

@corranwebster
Copy link
Contributor

Also, separately, this feels like it is a symptom, not the root cause: the axis bounds being inverted smells like there a problem with the values being passed to the ticking system. In particular, are we in a situation where the width (or height, depending on orientation) of the axis component is negative? If so, then all sorts of things may be messed up beyond ticking.

@aaronayres35
Copy link
Contributor

FWIW -
This same traceback was seen a while back:
#529
and that issue was closed by #636
but 636 was just checking for NaN inputs, not non-NaN inputs that could lead to NaNs inside the method

In this case, tick_interval on this line ends up as NaN

tick_interval = auto_interval(lower, upper)

and that is because log10 is getting negative inputs here
magnitudes = 10.0 ** floor(log10(candidate_intervals))

@corranwebster
Copy link
Contributor

Tentatively closing as this should be resolved (at least in the sense of treating the symptoms) by #848

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants