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

Handled bokeh log axes with axis lower bound <=0 #1691

Merged
merged 1 commit into from
Jul 7, 2017
Merged
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
10 changes: 7 additions & 3 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,12 @@ def _update_ranges(self, element, ranges):
xfactors, yfactors = self._get_factors(element)
framewise = self.framewise
if not self.drawn or (not self.model_changed(x_range) and framewise):
self._update_range(x_range, l, r, xfactors, self.invert_xaxis, self._shared['x'])
self._update_range(x_range, l, r, xfactors, self.invert_xaxis, self._shared['x'], self.logx)
if not self.drawn or (not self.model_changed(y_range) and framewise):
self._update_range(y_range, b, t, yfactors, self.invert_yaxis, self._shared['y'])
self._update_range(y_range, b, t, yfactors, self.invert_yaxis, self._shared['y'], self.logy)


def _update_range(self, axis_range, low, high, factors, invert, shared):
def _update_range(self, axis_range, low, high, factors, invert, shared, log):
if isinstance(axis_range, (Range1d, DataRange1d)) and self.apply_ranges:
if (low == high and low is not None and
not isinstance(high, util.datetime_types)):
Expand All @@ -573,6 +573,10 @@ def _update_range(self, axis_range, low, high, factors, invert, shared):
if shared:
shared = (axis_range.start, axis_range.end)
low, high = util.max_range([(low, high), shared])
if log and low <= 0:
low = 0.01 if high < 0.01 else 10**(np.log10(high)-1)
self.warning("Logarithmic axis range encountered value less than or equal to zero, "
"please supply explicit lower-bound to override default of %.3f." % low)
if low is not None and (isinstance(low, util.datetime_types)
or np.isfinite(low)):
axis_range.start = low
Expand Down