Reputation: 15
I am trying to make a chloropleth map in Dash Plotly and since the data is bound to Europe I want the default zoom to be focused on there. There should be a bounds fitting feature in Plotly, as described in the tutorial documentation:
https://plotly.com/python/map-configuration/
However, I cannot get it to work, not on my map, but not even on this basic tutorial, I am always getting:
ValueError: Invalid property specified for object of type plotly.graph_objs.layout.Geo: 'fitbounds'
It seems as if the fitbounds property is not defined for the geos, strange.
Code to replicate the issue:
fig = px.line_geo(lat=[0, 15, 20, 35], lon=[5, 10, 25, 30])
fig.update_geos(fitbounds="locations")
fig.update_layout(height=300, margin={"r": 0, "t": 0, "l": 0, "b": 0})
What could this be caused by?
Upvotes: 0
Views: 1244
Reputation: 711
For me just trying to understand your problem, I had to install nbformat package. And it works perfectly after installing it. maybe your problem is just an update issue. **please note that I can NOT make any comments yet and that's why I'm posting an answer!
pip(3) install --upgrade nbformat
pip(3) install --upgrade plotly
Upvotes: 2