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

invert_yaxis doesn't work in a layout unless shared_axes=False #5801

Open
droumis opened this issue Jul 11, 2023 · 3 comments
Open

invert_yaxis doesn't work in a layout unless shared_axes=False #5801

droumis opened this issue Jul 11, 2023 · 3 comments
Labels
TRIAGE Needs triaging

Comments

@droumis
Copy link
Member

droumis commented Jul 11, 2023

ALL software version info

Bokeh: 3.2.0
HoloViews: 1.16.2.post36+g99a3f2079-dirty
Panel: 1.2.0

Description of expected behavior and the observed behavior

Invert_yaxis is not working without setting shared_axes=False, and since I need to invert the y-axis of one plot in a layout while keeping the linked interactivity intact, I can't use shared_axes=False.

Complete, minimal, self-contained example code that reproduces the issue

import numpy as np
import xarray as xr
import panel as pn; pn.extension()
import holoviews as hv; hv.extension('bokeh')
import hvplot.xarray
import bokeh

N = 10
data = np.zeros((N, N, N))
indices = np.arange(N)
data[indices, indices, indices] = 1
da = xr.DataArray(data, coords=[("a", indices), ("b", indices), ("c", indices)], name="data")

player = pn.widgets.Player(start=int(da.coords['c'].values.min()), end=int(da.coords['c'].values.max()))

main_view = da.hvplot.image('a', 'b', groupby="c", widgets={"c": player}, width=300, colorbar=False)

neighbor_b = hv.Image(da.mean(['b']), ['a', 'c']).opts(width=300, colorbar=False, invert_yaxis=True) # invert not working without setting shared_axes=False

neighbor_r = hv.Image(da.mean(['a']), ['c', 'b']).opts(width=300, colorbar=False)

pn.Column(f"Bokeh: {bokeh.__version__}<br>HoloViews: {hv.__version__}<br>Panel: {pn.__version__}",
          player, pn.Row(main_view[0], neighbor_r), neighbor_b)

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

shared_axes=True

image

shared_axes=False

image
@droumis droumis added the TRIAGE Needs triaging label Jul 11, 2023
@droumis droumis moved this to Todo in CZI R5 neuro Jul 11, 2023
@droumis droumis changed the title invert_yaxis doesn't work in a layout unless shared_axes=False invert_yaxis doesn't work in a layout unless shared_axes=False Jul 11, 2023
@hoxbro
Copy link
Member

hoxbro commented Nov 8, 2023

This seems to be because there is a shared c kdims between the neighbor_b and neighbor_r. Where only neighbor_b has set the c axis to be inverted. A MRE could be this:

import holoviews as hv

hv.extension("bokeh")

data = (range(5), range(5))
plot1 = hv.Points(data, kdims=["c", "b"])
plot2 = hv.Points(data, kdims=["a", "c"]).opts(invert_yaxis=True)

plot1 + plot2

image

And with (plot1 + plot2).opts(shared_axes=False):
image

@hoxbro
Copy link
Member

hoxbro commented Nov 8, 2023

Maybe an option like this hv.Points(data, kdims=["a", "c"]).opts(shared_axes=["a"]) could be a way to solve the issue.

@MarcSkovMadsen
Copy link
Collaborator

This is also a problem when you use a parent heatmap with a tap stream to drive a child plot as in https://discourse.holoviz.org/t/how-to-keep-yaxis-of-heatmap-inverted-after-tap/7107.

@droumis droumis moved this from Todo to Dropped in CZI R5 neuro Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TRIAGE Needs triaging
Projects
None yet
Development

No branches or pull requests

3 participants