I have tried following the docs and various posts that discuss this and I have gotten nowhere. I am rendering the choropleth counties map from the plotly example, but I can't seem to figure out how to hide the colorbar. This is what I have tried:
import plotly.express as px
from urllib.request import urlopen
import json
import pandas as pd
with urlopen('https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json') as response:
counties = json.load(response)
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/fips-unemp-16.csv",
dtype={"fips": str})
fig = px.choropleth(
df,
geojson=counties,
locations='fips',
color='unemp',
color_continuous_scale="Viridis",
range_color=(0, 12),
scope="usa",
labels={'unemp':'Unemployment'}
)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}, coloraxis=dict(showscale=False))
fig.update(layout_coloraxis_showscale=False)
fig.update_traces(showlegend=False)
fig.update(layout_showlegend=False)
fig.update_traces(showscale=False)
fig.show()
My result is always the same:
I suggest you check your plotly version using
import plotly
plotly.__version__
If it is less than 5.1.0
then I suggest you update it using the following pip command
pip install -Iv plotly==5.1.0
I just used your code only and with this specific version of plotly i am getting a map without the colorbar