The page as a whole has a black background… and the white one on the states is an eyesore.
Any idea how to change it to black, too?
The page as a whole has a black background… and the white one on the states is an eyesore.
Any idea how to change it to black, too?
Hi @PropeReferio you can use the bgcolor
property of the go.layout.Geo
axis, and you’ll also need to set the paper_bgcolor
so that margins are also black.
For example
import plotly.graph_objects as go
fig = go.Figure(go.Scattergeo())
fig.update_geos(
visible=False, resolution=110, scope="usa",
showcountries=True, countrycolor="white",
showsubunits=True, subunitcolor="Blue",
showocean=True, oceancolor='black',
bgcolor='black'
)
fig.update_layout(height=300, margin={"r":0,"t":0,"l":0,"b":0},
paper_bgcolor='black'
)
fig.show()
You’re the best, thank you <3
Any idea how to disable zoom on the map?
You can disable the scroll zoom with a config option
import plotly.graph_objects as go
fig = go.Figure(go.Scattergeo())
fig.update_geos(
visible=False, resolution=110, scope="usa",
showcountries=True, countrycolor="white",
showsubunits=True, subunitcolor="Blue",
showocean=True, oceancolor='black',
bgcolor='black'
)
fig.update_layout(height=300, margin={"r":0,"t":0,"l":0,"b":0},
paper_bgcolor='black'
)
fig.show(config = dict({'scrollZoom': False}))
and if you want to remove zool alltogether you can remove the corresponding modebar buttons as described in https://plotly.com/python/configuration-options/#removing-modebar-buttons