Hi,
i am trying to overlay 2 dataframe into scattermap, i.e. 1 dataframe shows location of the house and another dataframe shows the station.
I manage to how the location of the house but unable to add_trace following the post below : Plotly Express multiple plots overlay
import plotly.graph_objs as go
df = pd.read_excel(‘List of appended HDB.xlsx’)
locations = [go.Scattermapbox(
lon=df_sub['LONG'],
lat=df_sub['LAT'],
mode='markers',
marker=go.scattermapbox.Marker(
size=7,
color=df['psf'],
showscale=True,
cmax=df_sub['psf'].max(),
cmin=df_sub['psf'].min()
),
unselected={'marker': {'opacity': 1}},
selected={'marker': {'opacity': 0.5, 'size': 25}},
hoverinfo='text',
hovertext=df_sub['hover'],
)]
return {
‘data’: locations,
‘layout’: go.Layout(
uirevision=‘foo’, #preserves state of figure/map after callback activated
clickmode=‘event+select’,
hovermode=‘closest’,
hoverdistance=2,
title=dict(text=“HDB Resale Pricing”, font=dict(size=30, color=‘green’)),
mapbox=dict(
accesstoken=mapbox_access_token,
bearing=0,
style=‘light’,
center=go.layout.mapbox.Center(
lat=1.335,
lon=103.8
),
pitch=40,
zoom=11.3
),
)
}
could anyone help me please?