我写 python plotly express 来制作一个等值线图
这是我的代码
import plotly.express as px
import pandas as pd
th_json = "https://raw.githubusercontent.com/apisit/thailand.json/master/thailand.json"
df = pd.read_csv("province-test.csv")
fig = px.choropleth_mapbox(df, geojson=th_json, color="value",
locations="provinces", featureidkey="properties.name",
center={"lat": 13.736717, "lon": 100.523186},
mapbox_style="open-street-map", zoom=4)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
(结果)
但我想要这样的背景(图2)我用python folium写
我想得到一个Choropleth的背景,该国所有省份的省份不在数据框中,数据框中的省份显示颜色主题(Plotly Express)
如何使用 Plotly Express 将背景设为国家(图 2)?