Hi there,
I have two brain surface data defined over the same mesh, one is a statistical map and the other a simple background which gives a nicer rendering of the brain. When displaying only one of these, everything works perfectly fine, I am using Mesh3d
and setting the intensity
and colorscale
, and I can display the colorbar (or not) based on a boolean input parameter.
This basically looks like this:
x, y, z = coords.T
i, j, k = faces.T
colorbar = True
mesh_3d = go.Mesh3d(x=x, y=y, z=z, i=i, j=j, k=k,
intensity=stat_map,
colorscale=colors,
showscale=colorbar)
Now, the problem is that the statistical map can be thresholded by the user, meaning that we donโt want to plot the statistical map values between -threshold
and +threshold
. Instead, we want to draw the background map with a different color scale (usually we use something like coldhot
for the stat map and Greys
for the background map). For the moment, the only way I could do that is to compute the color of each vertex and provide it through vertexcolor
instead of through intensity
and colorscale
to Mesh3d
:
vertexcolor = _get_vertexcolor(
surf_map, our_cmap, norm, threshold, bg_map
)
mesh_3d = go.Mesh3d(x=x, y=y, z=z, i=i, j=j, k=k,
vertexcolor=vertexcolor,
showscale=colorbar)
The output is what I expect except that I couldnโt find a way to display and customize the colorbar. The showscale
parameter is completely ignored and providing a colorscale
in addition to vertexcolor
to Mesh3d
doesnโt seem to solve the issue. Furthermore, Iโd like to be able to customize the colorbar to have a specific color for the threshoded part.
To give a better idea of what Iโm trying to do, this is what it looks like with Matplotlib
(threshold=2.0
) and what I would like to reproduce with plotly
:
Hope this post was understandable.
Let me know if not, and I will give more details.
Thanks for the amazing work!
Nicolas