Reputation: 113
I need to do two things in plotly that are both related with the color scaling.
1) I have a time series that I scatter on 3d
fig = go.Figure(data=go.Scatter(y=dy[roi_index],mode='markers',marker=dict(color=np.random.randn(8000),colorscale='Viridis',showscale=True,size=2)))
fig.show()
I want to continously color scale this time series as the time increases. So, no point has the same color since no point has the same time value, and the colors are changing as we go right.
2) I want to be able to remember these colors and when I map these set of points into 3d, I need to see the colors of the points in the time series.
fig = go.Figure(data=[go.Scatter3d(x=SW_M_tau_traces[roi_index][0], y=SW_M_tau_traces[roi_index][1], z=SW_M_tau_traces[roi_index][2],mode='markers',marker=dict(size=1,color=,
colorscale="Viridis"))])
fig.show()
This is what I am trying to say:
Upvotes: 1
Views: 1963
Reputation: 27370
Yes you can do this in both 2d and 3d:
import plotly.graph_objects as go
import numpy as np
# Helix equation
t = np.linspace(0, 10, 50)
x, y, z = np.cos(t), np.sin(t), t
fig = go.Figure(data=[go.Scatter3d(x=x, y=y, z=z, mode='markers',
marker_color=z, marker_colorscale='Viridis')])
fig.show()
fig = go.Figure(data=[go.Scatter(x=z, y=y, mode='markers',
marker_color=z, marker_colorscale='Viridis')])
fig.show()
Upvotes: 2