Hello,
I have a problem to share the z axis of dynamic QuadMesh inside a panel
Here is an example:
import panel as pn
import numpy as np
import holoviews as hv
from functools import partial
hv.extension("bokeh")
pn.extension()
radius = np.r_[np.linspace(100, 200, 50)]
theta = np.r_[np.linspace(0, 2*np.pi, 100)]
Radius,Theta = np.meshgrid(radius, theta)
X,Y = Radius*np.cos(Theta), Radius*np.sin(Theta)
data1 = np.random.rand(*X.shape, 10)
data2 = np.random.rand(*X.shape, 10) * (np.arange(10)+1)[None, None,:]
def make_quad(index, X, Y, data):
quad = hv.QuadMesh((X,Y,data[:,:,index]))
return quad.opts(frame_width=400, colorbar=True, aspect=1)
index_selector = pn.widgets.IntSlider(value=5, start=0, end=9)
dmap1 = hv.DynamicMap(pn.bind(partial(make_quad, X=X, Y=Y, data=data1), index_selector))
dmap2 = hv.DynamicMap(pn.bind(partial(make_quad, X=X, Y=Y, data=data2), index_selector))
pn.Column(index_selector, pn.Row(pn.pane.HoloViews(dmap1, linked_axes=True), pn.pane.HoloViews(dmap2, linked_axes=True)))
I’d like both quadmesh share the same colorbar
I tried to use a hv Layout for both dynamicmaps
pn.Column(index_selector, dmap1 + dmap2)
but it works only on the first render, if the value of the slider is changed colorbar are not shared anymore