用于在Python和Plotly中更改贴图Choroplethmapbox上的值的菜单或按钮
我想知道是否可以使用python的菜单或按钮仅更改Choroplethmappbox类型的图形中的“z”值,例如:用于在Python和Plotly中更改贴图Choroplethmapbox上的值的菜单或按钮,python,plotly,choropleth,plotly-python,Python,Plotly,Choropleth,Plotly Python,我想知道是否可以使用python的菜单或按钮仅更改Choroplethmappbox类型的图形中的“z”值,例如: fig = go.Figure(go.Choroplethmapbox(geojson=datosqgis, locations=df.id, z=df.Join_Count, colorscale="YlOrRd", zmin=0, zmax=80,
fig = go.Figure(go.Choroplethmapbox(geojson=datosqgis, locations=df.id, z=df.Join_Count,
colorscale="YlOrRd", zmin=0, zmax=80,
marker_opacity=0.5, marker_line_width=0, layout =layout)
(...)
fig.update_layout(
updatemenus=[
go.layout.Updatemenu(
direction="down",
active=0,
x = 0.01,
xanchor = 'left',
y = 0.6,
yanchor = 'bottom',
buttons=list([
dict(label="Año 2013",
method="restyle",
args=[{"z": df.Join_Count}]), #Value 2013
dict(label="Año 2014",
method="restyle",
args=[{"z": df.Join_Count_2014}]), #Value 2014
dict(label="Año 2015",
method="restyle",
args=[{"z": df.Join_Count_2015}]) #Value 2015
]),
)
])
虽然这段代码对我不起作用,但我尝试加载几个具有不同“z”值的图形,并使它们可见和不可见,如果它起作用,但我加载了几次GEOJSON,这使它更重