Hi @garret
Please tell us what trace type are you defining? What I said about colorbar is still valid. Check it running this code:
import plotly.express as px
px.set_mapbox_access_token(open(".mapbox_token").read())
df = px.data.carshare()
fig = px.scatter_mapbox(df, lat="centroid_lat", lon="centroid_lon", color="peak_hour", size="car_hours",
color_continuous_scale=px.colors.cyclical.IceFire, size_max=15, zoom=10)
fig.show()
Then in a notebook cell:
fig.layout.coloraxis
and you’ll get displayed:
layout.Coloraxis({
'colorbar': {'title': {'text': 'peak_hour'}},
'colorscale': [[0.0, '#000000'], [0.0625, '#001f4d'], [0.125, '#003786'],
[0.1875, '#0e58a8'], [0.25, '#217eb8'], [0.3125, '#30a4ca'],
[0.375, '#54c8df'], [0.4375, '#9be4ef'], [0.5, '#e1e9d1'],
[0.5625, '#f3d573'], [0.625, '#e7b000'], [0.6875, '#da8200'],
[0.75, '#c65400'], [0.8125, '#ac2301'], [0.875, '#820000'],
[0.9375, '#4c0000'], [1.0, '#000000']]
})
Now this update:
fig.update_layout(coloraxis_showscale=False)
removes the colorbar. (I have Plotly 4.6.0, too)
It seems that you are not making distinction between legend and colorbar The colorbar is always associated when you are setting a colorscale, and the showscale=True
(its default value is True), and almost sure your comment above is referring to a trace type that doesn’t colormap a list of values to a colorscale.