I am struggling to figure out why then I change the slider the map refreshed however I am unable to zoom in. I was wondering if anyone could help:
app = dash.Dash()
app.layout = html.Div(children=[
html.Div(id="slider_output"),
html.Div(dcc.RangeSlider(id="size_slider",
min=df.col1.min(),
max=df.col2.max(),
step=1000,
)),
html.Div(dcc.Graph(id='map',figure={"data":data,"layout":layout})),
])
@app.callback(dd.Output(“map”,“figure”),
[dd.Input(“size_slider”,“value”)])
def create_updated(size_slider):
x = size_slider[0]
y = size_slider[1]
df_x = df[(df.Size_metric >= x) & (df.Size_metric <= y)]
data = [go.Scattermapbox(lat = df_x.Lat, lon = df_x.Long,
mode = 'markers',
marker = dict(size = 10,color='red'),
)]
layout = go.Layout(autosize = False,
height = 800,
width = 800,
hovermode = 'closest',
showlegend = False,
mapbox = dict(accesstoken = mapbox_access_token,
center=dict(
lat=51.50,
lon=1.12
),
pitch=0,
zoom=5.5,
style=Tin_foil_hat
),
paper_bgcolor = '#F2F4F4',
margin = {"l":0,"b":0,"r":0,"t":0}
)
return {"data":data,"layout":layout}
if name in ‘main’:
app.run_server()