I am using a fairly recently created environment (so recent libs). I downloaded the sample notebook Trimesh — HoloViews 1.14.5 documentation and added the following cells to create a trimesh in a function. The dynamic map created by this does not update. Am I missing something or is it broken ?
def generate_trimesh(n_angles, n_radii):
min_radius=0.25
# First create the x and y coordinates of the points.
radii = np.linspace(min_radius, 0.95, n_radii)
angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
angles[:, 1::2] += np.pi/n_angles
x = (radii*np.cos(angles)).flatten()
y = (radii*np.sin(angles)).flatten()
z = (np.cos(radii)*np.cos(angles*3.0)).flatten()
nodes = np.column_stack([x, y, z])
# Apply Delaunay triangulation
delaunay = Delaunay(np.column_stack([x, y]))
# Mask off unwanted triangles.
xmid = x[delaunay.simplices].mean(axis=1)
ymid = y[delaunay.simplices].mean(axis=1)
mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
simplices = delaunay.simplices[np.logical_not(mask)]
nodes = hv.Points(nodes, vdims='z')
trimesh = hv.TriMesh((simplices, nodes))
return trimesh.opts(
opts.TriMesh(cmap='viridis', edge_color='z', filled=True, height=400,
tools=['hover'], width=400))
Are you saying that it does not update in response to the n_angles and n_radii widgets, or to zooming? If for zooming, I think the streams that handle range updates will be missing in the above. You can put them in manually, but I myself would just use pn.bind from Panel to add widgets like this, which shouldn’t need any special handling of the streams.
There is a warning when displaying the dynamic map
c:\Users\psandhu\Miniconda3\envs\env_iwfm\lib\site-packages\holoviews\element\util.py:318: FutureWarning: Passing 'suffixes' which cause duplicate columns {'z_x'} in the result is deprecated and will raise a MergeError in a future version.
df = pd.merge(df, nodes, left_on=[v3.name], right_on=[idx.name])
c:\Users\psandhu\Miniconda3\envs\env_iwfm\lib\site-packages\holoviews\element\util.py:318: FutureWarning: Passing 'suffixes' which cause duplicate columns {'z_x'} in the result is deprecated and will raise a MergeError in a future version.
df = pd.merge(df, nodes, left_on=[v3.name], right_on=[idx.name])
When I move the sliders for either kdim I get this error in the js console
Exception in Comm callback Error: Size mismatch
at Object.e.assert (eval at append_javascript (outputarea.js:758), <anonymous>:316:158)
at a.select (eval at append_javascript (outputarea.js:758), <anonymous>:330:2590)
at x.set_data (eval at append_javascript (outputarea.js:758), <anonymous>:403:3587)
at V.set_data (eval at append_javascript (outputarea.js:758), <anonymous>:366:3458)
at V.update_data (eval at append_javascript (outputarea.js:758), <anonymous>:366:3303)
at V.t (eval at append_javascript (outputarea.js:758), <anonymous>:366:1905)
at V.s (eval at append_javascript (outputarea.js:758), <anonymous>:347:447)
at r.emit (eval at append_javascript (outputarea.js:758), <anonymous>:320:657)
at r.emit (eval at append_javascript (outputarea.js:758), <anonymous>:320:742)
at _setv (eval at append_javascript (outputarea.js:758), <anonymous>:319:4716) Error: Size mismatch
at Object.e.assert (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:316:158)
at a.select (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:330:2590)
at x.set_data (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:403:3587)
at V.set_data (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:366:3458)
at V.update_data (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:366:3303)
at V.t (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:366:1905)
at V.s (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:347:447)
at r.emit (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:320:657)
at r.emit (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:320:742)
at _setv (eval at append_javascript (http://localhost:8889/static/notebook/js/main.min.js?v=f1ffcc85342b2a9c45ba434c8f1ce101d995e4384bfa196254b0682e057f067d246c34e884bed8d784d3165a09864d5dc58f19b32fcab07130e8f9542f7c76a5:59195:13), <anonymous>:319:4716) {header: {…}, msg_id: "8d45701e-63f56cc4bd76ae38a4893cb3_33760_6822", msg_type: "comm_msg", parent_header: {…}, metadata: {…}, …}
Those error messages aren’t something I know how to address, and probably indicate that it’s worth figuring out a minimum reproducible example and filing it as a github bug report. In this case it can be a minimum difference from the existing example, or at least a full .py file sufficient to reproduce it.