HI, I think up to certain extend you could use go.Mesh3d
, it depends on the number of datapoints you want to visualize.
Pretty much like this:
EDIT:
I played around a bit, I think you will run into performance issues quite quickly. It took some time to plot the figure and itβs only 25 βtowersβ
import plotly.graph_objects as go
import numpy as np
def towers(a, e, pos_x, pos_y):
# create points
x, y, z = np.meshgrid(
np.linspace(pos_x-a/2, pos_x+a/2, 2),
np.linspace(pos_y-a/2, pos_y+a/2, 2),
np.linspace(0, e, 2)
)
x = x.flatten()
y = y.flatten()
z = z.flatten()
return go.Mesh3d(x=x, y=y, z=z, alphahull=1, flatshading=True)
Usage:
# dimensions of global grid
x_dim = 5
y_dim = 5
x, y = np.meshgrid(
np.arange(x_dim),
np.arange(y_dim)
)
xx = x.flatten()
yy = y.flatten()
zz = np.random.randint(2, 20, size=(xx.shape[0] + yy.shape[0]))
fig = go.Figure(layout={'scene': {'aspectmode':"data"}, 'height':700, 'width':800})
for x, y, z in zip(xx, yy, zz):
fig.add_trace(towers(1, z, x, y))
creates:
1 Like