João Fernandes
João Fernandes

Reputation: 505

Change the colors of a scatterplot3d trough plotly python

So, I have 4 columns and I assigned the first 3 to the x,y,z labels of a scatterplot3d in plotly python. My 4 colunm is an array of 1 and 0 and I wanted to set the color of my scatterplot 3D acoording to my 4 column. I also managed that, however, I wanted that it gives me 3 different colors (the third color is related to the points that have the same x,y,z coordinates). Can anyone help me please?

Thanks

Upvotes: 0

Views: 6756

Answers (1)

mauve
mauve

Reputation: 2763

Looking at this: 3 d scatter plots in plot.ly

The second example seems to be relevant. Change "color = z" to your 4th column

trace1 = go.Scatter3d(
    x=x,
    y=y,
    z=z,
    mode='markers',
    marker=dict(
        size=12,
        color=z,                # set color to an array/list of desired values
        colorscale='Viridis',   # choose a colorscale
        opacity=0.8
    )
)

Upvotes: 4

Related Questions