Maybe this us a beginner’s question…
I am trying to plot a mapbox scatter of timestamped values. To get a nice continuous color range, I map the timestamps to integers. However, in the end I want to see the original timestamps again in the color scale legend, not the integers. How do I do that?
Picture attached. The labels below “color” should display the timestamps.
df_nonan = df.dropna(subset=['Counts_DC_#cm3'])
date_to_val = df_nonan['DateTime'].map(pd.Series(data=np.arange(len(df_nonan)), index=df_nonan['DateTime'].values).to_dict())
fig_map = go.Figure()
fig_map = px.scatter_mapbox(df_nonan, lat="Lat", lon="Lon", color=date_to_val, size="Counts_DC_#cm3",
color_continuous_scale=px.colors.sequential.Inferno, size_max=25, zoom=15, height=800,
)
fig_map.update_traces(
patch=dict(mode='text+markers', text=df_nonan['DateTime'], marker_opacity=0.2),
selector=dict(type='scattermapbox'))
fig_map.show()