Is there a way to update the opts of a plot without completely reloading the plot?
I have a dynamic panel based app where I would like to change things on the fly (such as frame_width) without resetting the plot each time. Below is how my plot is constructed (as part of a param class)
hv_image = hv.QuadMesh(
(
numpy.nan_to_num(self._dataset.xc.values),
numpy.nan_to_num(self._dataset.yc.values),
element_arr,
)
)
cmap_r = colorcet.palette[self.colour_map]
self.plot = rasterize(hv_image, aggregator=self.zoom_aggregation,).apply.opts(
xaxis=None if not self.show_axes else "bottom",
yaxis=None if not self.show_axes else "left",
aspect="equal",
frame_width=self.plot_width,
frame_height=self.plot_height,
cmap=cmap_r,
clim=(self.MIN_VAL, self.MAX),
colorbar=True,
logz=self.log_colour,
tools=["hover"],
cformatter=tickformat,
)
And i would like to be able to do something like this (which doesn’t currently work)
@param.depends(
"plot_width",
watch=True,
)
def update_plot(self):
if self.plot is not None:
print(f"Updating width {self.plot_width}")
self.plot.frame_width = self.plot_width