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

Handle empty tag in Bokeh element #5851

Merged
merged 2 commits into from
Aug 16, 2023
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
22 changes: 18 additions & 4 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ def _update_ranges(self, element, ranges):
continue
self._update_range(
extra_y_range, b, t, factors,
extra_y_range.tags[1]['invert_yaxis'] if extra_y_range.tags else False,
self._get_tag(extra_y_range, 'invert_yaxis'),
self._shared.get(extra_y_range.name, False), log, streaming
)

Expand Down Expand Up @@ -1111,10 +1111,24 @@ def _update_main_ranges(self, element, x_range, y_range, ranges):
self._update_range(x_range, l, r, xfactors, self.invert_xaxis,
self._shared['x-main-range'], self.logx, streaming)
if not self.drawn or yupdate:
self._update_range(y_range, b, t, yfactors,
y_range.tags[1]['invert_yaxis'] if y_range.tags else False,
self._shared['y-main-range'], self.logy, streaming)
self._update_range(
y_range, b, t, yfactors, self._get_tag(y_range, 'invert_yaxis'),
self._shared['y-main-range'], self.logy, streaming
)

def _get_tag(self, model, tag_name):
"""Get a tag from a Bokeh model

Args:
model (Model): Bokeh model
tag_name (str): Name of tag to get
Returns:
tag_value: Value of tag or False if not found
"""
for tag in model.tags:
if isinstance(tag, dict) and tag_name in tag:
return tag[tag_name]
return False

def _update_range(self, axis_range, low, high, factors, invert, shared, log, streaming=False):
if isinstance(axis_range, FactorRange):
Expand Down