Hi everyone,
We have spoken about size of cones (Cones Size Problem - #2 by Bijan) But there is a problem when we use many cones in a command (fig.add_cone
). For better understanding take a look to the below codes:
import plotly.graph_objects as go
import plotly as plt
import numpy as np
import random as rnd
def rndata():
a=0
b=10
n=1
rslt=[]
for i in range(n):
rslt.extend([rnd.randint(a,b),rnd.randint(a,b),None])
return rslt
fig = go.Figure()
u,v,w=[],[],[]
xx,yy,zz=[],[],[]
for i in range(10):
x= rndata()
y=rndata()
z=rndata()
size=((x[1]-x[0])**2+(y[1]-y[0])**2+(z[1]-z[0])**2)**0.5
axis=[(x[1]-x[0])/size,(y[1]-y[0])/size,(z[1]-z[0])/size]
fig.add_scatter3d(x=x,y=y,z=z,mode="lines")
u.extend([axis[0],None])
v.extend([axis[1],None])
w.extend([axis[2],None])
xx.extend([x[1],None])
yy.extend([y[1],None])
zz.extend([z[1],None])
sizes=rnd.randint(1,5)
fig = fig.add_cone( opacity=0.5, sizemode='absolute',sizeref=sizes,showscale=False,
colorscale=[cl,cl],
anchor='tip', #['tip', 'tail', 'cm', 'center']
x=xx, y=yy, z=zz, u=u, v=v, w=w,
text=str(sizes))
fig.update_layout(scene_aspectmode='data',)
fig.show()
When we run above code it doesnβt return correct sizes of cones (check it by running multiple times) but when we run the codes in ( Cones Size Problem - Plotly Python - Plotly Community Forum) sizes are correct. Is it a bug or there is a solution?