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

Fix issue with range lookups in (y)-axis creation #6274

Merged
merged 3 commits into from
Jun 11, 2024
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
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ def _axis_props(self, plots, subplots, element, ranges, pos, *, dim=None,
elif pos == 1 and dim:
dims = [dim]
v0, v1 = util.max_range([
elrange.get(dim.name, {'combined': (None, None)})['combined']
elrange.get(dim.label, {'combined': (None, None)})['combined']
for elrange in ranges.values()
])
axis_label = str(dim)
Expand Down Expand Up @@ -843,7 +843,7 @@ def _create_extra_axes(self, plots, subplots, element, ranges):
if self._subcoord_overlaid:
if opts.get('subcoordinate_y') is None:
continue
if element.kdims:
if sp.overlay_dims:
ax_name = ', '.join(d.pprint_value(k) for d, k in zip(element.kdims, sp_key))
else:
ax_name = el.label
Expand Down
39 changes: 39 additions & 0 deletions holoviews/tests/plotting/bokeh/test_overlayplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,45 @@ def test_ndoverlay_subcoordinate_y_no_batching(self):
assert plot.batched == False
assert len(plot.subplots) == 10

def test_ndoverlay_subcoordinate_y_ranges(self):
data = {
'x': np.arange(10),
'A': np.arange(10),
'B': np.arange(10)*2,
'C': np.arange(10)*3
}
overlay = NdOverlay({
'A': Curve(data, 'x', ('A', 'y')).opts(subcoordinate_y=True),
'B': Curve(data, 'x', ('B', 'y')).opts(subcoordinate_y=True),
'C': Curve(data, 'x', ('C', 'y')).opts(subcoordinate_y=True),
})
plot = bokeh_renderer.get_plot(overlay)

assert plot.state.y_range.start == -0.5
assert plot.state.y_range.end == 2.5
for sp in plot.subplots.values():
assert sp.handles['y_range'].start == 0
assert sp.handles['y_range'].end == 27

def test_overlay_subcoordinate_y_ranges(self):
data = {
'x': np.arange(10),
'A': np.arange(10),
'B': np.arange(10)*2,
'C': np.arange(10)*3
}
overlay = Overlay([
Curve(data, 'x', ('A', 'y'), label='A').opts(subcoordinate_y=True),
Curve(data, 'x', ('B', 'y'), label='B').opts(subcoordinate_y=True),
Curve(data, 'x', ('C', 'y'), label='C').opts(subcoordinate_y=True),
])
plot = bokeh_renderer.get_plot(overlay)

assert plot.state.y_range.start == -0.5
assert plot.state.y_range.end == 2.5
for sp in plot.subplots.values():
assert sp.handles['y_range'].start == 0
assert sp.handles['y_range'].end == 27


class TestLegends(TestBokehPlot):
Expand Down