Capture current zoom

Is it possible to capture the current zoom area of a plot, update the plot, and reapply the zoom area? I am working on time series data and I have Panel widgets that update a plot. When the plot is redrawn the zoom is lost forcing the user to zoom in again which makes things tedious. Below is an example of the plot. The first image show the plot as it is initially drawn. The second show a comfortable zoom level. When I use a widget that updates the plot, the plot changes from the comfortable zoom back to the initial plot view.

I think you’re looking for DynamicMap; see
https://pydeas.readthedocs.io/en/latest/holoviz_interactions/tips_and_tricks.html#Wrap-DynamicMap-around-Panel-methods-to-maintain-extents-and-improve-runtime

Also related:
https://panel.holoviz.org/reference/panes/HoloViews.html#widgets

However, if you do need the zoom_range,

@ahuang11 Thank you very much! That fixed my problem.

1 Like