Hi,
I’ve struggled to create my own hover text for the go.surface plot.
I tried some different ways based on the following tutorials:
https://chart-studio.plotly.com/~empet/14813/heatmap-plot-on-a-spherical-map/#/
However, the created figure shows just single character which I do not expect.
Any helps will be appreciated.
My code:
n_rows, n_cols = xs.shape
text_topo=[['{:.2f}'.format(xs[i, j])+'<br>'+'{:.2f}'.format(ys[i, j])+'<br>'+'{:.2f}'.format(zs[i,j]) for j in range(n_cols)] for i in range(n_rows)]
xs, ys, and zs are numpy.ndarray
xs.shape is “(n_rows, n_cols)”
topo_sphere=dict(type='surface',
x=xs,
y=ys,
z=zs,
colorscale=Ctopo,
surfacecolor=topo,
cmin=cmin,
cmax=cmax,
showscale=False,
text=text_topo,
hoverinfo='text'
)
titlecolor = 'white'
bgcolor = 'black'
layout = go.Layout(
autosize=False, width=1500, height=800,
title = '3D spherical topography map',
titlefont = dict(family='Courier New', color=titlecolor),
showlegend = False,
scene = dict(
xaxis = noaxis,
yaxis = noaxis,
zaxis = noaxis,
aspectmode='manual',
aspectratio=go.layout.scene.Aspectratio(
x=1, y=1, z=1)),
paper_bgcolor = bgcolor,
plot_bgcolor = bgcolor)
plot_data=[topo_sphere]
fig = go.Figure(data=plot_data, layout=layout)
plot(fig, validate = False, filename='SphericalTopography.html', auto_open=True)