title: Control MapBox Extent in Plotly Python API
body: <p>The Plotly Python API can use MapBox (ScatterMapbox) to make nice interactive maps, but there is no way to control the map extent.  Being able to control the map extent is important if you, for instance, want to save the image as a PDF or PNG file and not expect the user to zoom interactively.  </p>
  
  <p>The problem I am facing is that there is no way to indicate directly that you want to view only a certain region.  For example, there is no way to indicate that you want the map to only show the state of Florida.  </p>
  
  <p>You can, however, set the CENTER of the map and the ZOOM level.  Is there a formula that one could use to define the ZOOM level when you know the lat/long coordinates of the box you want visible and you know the CENTER coordinates?  </p>
  
  <p>For example, if I want the map to be centered at coordinates (center_lat, center_long) and be zoomed such that the visible portion has the SOUTHWEST coordinates (sw_lat, sw_long) and the NORTHEAST coordinates (ne_lat, ne_long), what is the MapBox ZOOM level that I have to provide?</p>
  
  <p>I realize that the formula may depend on the map projection, which is why I am being specific about using MapBox and Plotly.  In addition, I have seen similar questions on SO but those seem to all relate to using MapBox via JS, rather than in the Plotly Python API, which made it hard for me to translate the solution into something that I think I can use.</p>