I am struggling with plotting something, that I thought should be really simple. I have a dataframe/table
df that contains the coordinates x,y,z of spheres. Additionally, in a separate column, it contains the radius of these spheres. How can I make with plotly a 3d plot of the spheres in space with their correct radius being used?
The closest I have come to making this plot is this code:
import plotly.express as px import plotly.graph_objects as go x =y=z = np.arange(1,4) fig = go.Figure() fig.add_trace(go.Scatter3d( mode='markers', x=x, y=y, z=z, marker=dict(color=px.colors.qualitative.D3,size=[50, 5, 25],sizemode='diameter' ) ) )
This produces almost what I want (see below), but notice that the sizes of the spheres are not correct - the ratios between the sphere sizes are correct, but I want
size to provide the absolute size of the spheres in the plot. How can I make this plot work with plotly (or worst case with another library)? Also, I would like to have the spheres being semi-transparent, because some smaller ones might be inside bigger ones and I want to see that. Tnx!