I am trying to plot two separate df’s on one map figure using Plotly Express & ScatterMapBox. They actual DF’s I am using cannot be combined together, as they are sized differently, and I intend to make one DF have interactive graphs in a Dash App at a later date. I have tried .add_trace, and .add_scattermapbox as well as a series of other .add functions. I am at a loss trying to figure out how to do this from the documentation alone. I know I can concat the df’s together. I am explicitly trying to avoid that as it prevents me from being able to apply different labels, heat-maps and other functions found with px.scatter_mapbox that I want to preserve.
import plotly.express as px
import pandas as pd
import numpy as np
px.set_mapbox_access_token(## Put your mapbox access token here ##)
df1 = pd.DataFrame(data=[[68.8281,34.7656],[68.2281,34.7958]],columns=['lat','lon'])
df2 = pd.DataFrame(data=[[68.7871,34.9012],[68.1223,34.8432]],columns=['lat','lon'])
fig = px.scatter_mapbox(df1, lat="lat", lon="lon",size_max=15, zoom=8)
fig2 = px.scatter_mapbox(df2, lat="lat", lon="lon",size_max=15, zoom=8)
### Do something here to make both of them show up on fig.show ###
fig.show()