Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 11 additions & 6 deletions chaco/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

""" Defines the PlotAxis class, and associated validator and UI.
"""
import logging

# Major library import
from numpy import (
array,
Expand Down Expand Up @@ -58,6 +60,8 @@
from .label import Label
from .log_mapper import LogMapper

logger = logging.getLogger(__name__)


def DEFAULT_TICK_FORMATTER(val):
return ("%f" % val).rstrip("0").rstrip(".")
Expand Down Expand Up @@ -500,20 +504,21 @@ def _compute_tick_positions(self, gc, overlay_component=None):
screenlow, screenhigh = screenhigh, screenlow

if (
(datalow == datahigh)
(datalow >= datahigh)
or (screenlow == screenhigh)
or (datalow in [inf, -inf])
or (datahigh in [inf, -inf])
):
if datalow > datahigh:
logger.warning(
"{self.mapper} has an invalid data range with "
"low={datalow} > high={datahigh}; unable to compute axis "
"ticks."
)
self._reset_cache()
self._cache_valid = True
return

if datalow > datahigh:
raise RuntimeError(
"DataRange low is greater than high; unable to compute axis ticks."
)

if not self.tick_generator:
return

Expand Down
2 changes: 2 additions & 0 deletions chaco/ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ def auto_ticks(

if upper > end:
end += tick_interval
if isnan([start, end]).any():
return []
ticks = arange(start, end + (tick_interval / 2.0), tick_interval)

if len(ticks) < 2:
Expand Down