Geographical map that zooms to and highlights a given country

Hi all,

I’m trying to have a geographical map that zooms to and highlights a country depending on the value of a drop down. I couldn’t find the perfect solution but for now I am using a Choropleth and passing a single location. However, I can’t figure out how to set the zoom for this map.

I’d appreciate any leads on how to set the default zoom or on a better way of achieving this.

Thanks a lot!

1 Like

Hi @shanv, the 4.5 release of plotly (last week! See 📣 Announcing 4.5) introduced a fitbounds attributed to geo layout in order to zoom on represented data only. See for example


Thanks, that’s a great feature.

Unfortunately, I’m restricted to using plotly 4.4.1

Do you have any suggestions for this case?

oh no… sorry to hear that you cannot use our recent improvements. As a workaround you can retrieve latitude and longitude coordinates of countries, store them in a dataframe and update manually the lataxis_range and lonaxis_range (

Just curious, why are you restricted? Is there something in our code preventing you from upgrading or is this latest version not available on your internal network?

Ah perfect. This works great, thanks so much!

It’s not available on the network as of now