Hi there, I have a question on how to keep the x and y axis ranges when changing variables in a Panel dashboard. This is similar to the question at Not change Bokeh axes limits with Dynamic Map, but on a pandas DataFrame instead of an xarray Dataset. Here’s a minimal code example:
# %%
import numpy as np
import pandas as pd
import panel as pn
import hvplot.pandas
# Example pandas dataframe with x, y, z1 and z2 columns
data = 10 * np.random.rand(100, 4)
df = pd.DataFrame(data=data, columns=["x", "y", "z1", "z2"])
# x y z1 z2
# 0 8.366391 4.803666 2.127830 9.435238
# 1 5.480135 1.173533 2.834300 8.722445
# 2 9.859487 6.385979 9.566771 2.205684
# 3 8.638108 0.138157 9.362423 3.890024
# 4 4.635330 9.695100 4.315197 3.976624
Currently I can zoom in and out of the xy scatter plot just fine, but when I change ‘c’ to color based on the ‘z2’ column instead of ‘z1’, the zoom resets to the original plot. Is there a way to keep the zoom level as it is when switching columns?
Awesome, thank you so much for this! Good to know that there’s a way to accomplish this in hvplot! Glad to see that the param selector can be wrapped by panel widgets too!
Just another (hopefully quick) question, is there a way to keep the wheel zoom on by default? When toggling between ‘z1’ and ‘z2’, the wheel zoom tool gets deactivated and I have to reactivate it each time.
You can choose which tools you want to activate by default with the option active_tools.
In this example, you just need to change the first line of the view function by :
I have the same problem but this solution is not working for me. I’m using Holoviews 1.14.0 and hvplot 0.7.0. The Web console complains about ReferenceError on the JavaScript side but I don’t know any more than that.