holoviz / holoviz/hvplot

Odd behavior with invert_yaxis, invert_xaxis

Open
#707 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

#### ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)
panel: 0.12.4
param: 1.12.0
jupyterlab: 3.0.16
holoviews: 1.14.7
hvplot: 0.7.2
bokeh: 2.4.2
#### Description of expected behavior and the observed behavior
Expected:
1) that the image hvplot would invert y and x axis when triggered
2) inverting the axis would not affect view of plot

Observed:
1) image plot disappears when either x or y axis is inverted
2) view of both plots continually zooms in each time the axis is inverted

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

```
import holoviews as hv
import panel as pn
import param
import numpy as np
import hvplot.xarray
import xarray as xr
hv.extension('bokeh', logo=False)

data = xr.tutorial.open_dataset('air_temperature').air

class Viewer(param.Parameterized):
tabs_switch = param.Boolean(True, label="Toggle Tabs")
cmap = param.Selector(objects=["rainbow", "fire", "bwr"])
invert_yaxis = pn.widgets.Checkbox(value=False, name='Invert y axis')
invert_xaxis = pn.widgets.Checkbox(value=False, name='Invert x axis')

def __init__(self, **params):
super().__init__(**params)

self.opts = dict(cmap=self.param.cmap, invert_yaxis=self.invert_yaxis, invert_xaxis=self.invert_xaxis, padding=0,
height=800, width=800)

self.plot = pn.pane.HoloViews()

self.make_layout()

self.column = pn.Column(
pn.WidgetBox(pn.Param(self.param, parameters=["tabs_switch", "cmap"]), self.invert_yaxis, self.invert_xaxis),
self.plot
)

def create_image(self):
x, y = np.mgrid[-50:51, -50:51] * 0.05
img = data.hvplot(x='lon', y='lat').opts(colorbar=True)
return img

def create_contours(self):
img = self.create_image()
contours = hv.operation.contours(img, levels=10, filled=True)
return contours

@param.depends("tabs_switch", watch=True)
def make_layout(self):
image = self.create_image()
contours = self.create_contours()
self.plot.object = hv.Layout(image.apply.opts(**self.opts) +\
contours.apply.opts(**self.opts)).opts(tabs=self.tabs_switch)

v = Viewer()
se = pn.serve(v.column)

```

#### Screenshots or screencasts of the bug in action

https://user-images.githubusercontent.com/71399442/154738786-650043a9-a525-4421-9503-0cfe6c2f57b8.mov

Appears to be a bug to me. Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.