1 回答

TA貢獻(xiàn)2012條經(jīng)驗(yàn) 獲得超12個(gè)贊
在這種情況下,我寧愿使用plotly.express
withcolor=df['risk']
然后設(shè)置color_discrete_map={'High':'red', 'Moderate':'Yellow','Low':'Green'}
:
陰謀:
完整代碼:
import plotly.express as px
import pandas as pd
fig = px.choropleth(locations=df['Country'],
locationmode="country names",
color=df['risk'],
color_discrete_map={'High':'red',
'Moderate':'Yellow',
'Low':'Green'}
#scope="usa"
)
fig.show()
添加回答
舉報(bào)