@hillard28
I created a minimal working example of US map and an inset for Alaska. You have to add go.Choroplethmapbox
for both US and Alaska, instead my go.Scattermapbox
(es).
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(
specs=[[{'type': 'mapbox'}]],
insets=[{'type': 'mapbox',
'l':0.0,
'w':0.25,
'h':0.48}])
fig.add_trace(go.Scattermapbox(lon=[-101.29], lat=[42.11], marker_size=8)) # 47.1164° N, 101.2996° W
fig.add_trace(go.Scattermapbox(lon=[-150.49], lat=[64.80], subplot= "mapbox2")) #64.2008° N, 149.4937° W
fig.update_layout(mapbox=dict(style="open-street-map", center_lon=-101.29, center_lat=42.11, zoom=1.75 ),
mapbox2=dict(style="open-street-map", center_lon =-150.49, center_lat=64.80, zoom=1.55))
These are the keywords for inset definition ( i got them printing help(make_subplots)
insets: list of dict or None (default None):
Inset specifications. Insets are subplots that overlay grid subplots
- Each item in 'insets' is a dictionary.
The available keys are:
* cell (tuple, default=(1,1)): (row, col) index of the
subplot cell to overlay inset axes onto.
* type (string, default 'xy'): Subplot type
* l (float, default=0.0): padding left of inset
in fraction of cell width
* w (float or 'to_end', default='to_end') inset width
in fraction of cell width ('to_end': to cell right edge)
* b (float, default=0.0): padding bottom of inset
in fraction of cell height
* h (float or 'to_end', default='to_end') inset height
in fraction of cell height ('to_end': to cell top edge)
For your examples you have to choose an adequate 'w'
(width) and 'h'
(height) for the inset, and zoom
value for each mapbox.
Here is the image of the above fig of Scattermapboxes: