显示各国名称和奖牌数
import pandas as pd
import plotly.express as px
data=pd.read_csv('数据.csv',encoding='gbk')
fig=px.sunburst(data,path=['洲','国'],values='奖牌数',color='金牌数',color_continuous_scale='blues')
fig.update_traces(textinfo='label+value')
fig.show()
显示各国名称和奖牌数在全球的百分比
import pandas as pd
import plotly.express as px
data=pd.read_csv('数据.csv',encoding='gbk')
fig=px.sunburst(data,path=['洲','国'],values='奖牌数',color='奖牌数',color_continuous_scale='blues')
fig.update_traces(textinfo='label+percent root')
fig.show()
显示各国名称和奖牌数在对应所在洲的百分比
import pandas as pd
import plotly.express as px
data=pd.read_csv('数据.csv',encoding='gbk')
fig=px.sunburst(data,path=['洲','国'],values='奖牌数',color='奖牌数',color_continuous_scale='blues')
fig.update_traces(textinfo='label+percent parent')
fig.show()
显示各国名称、奖牌数和奖牌数在全球的百分比
import pandas as pd
import plotly.express as px
data=pd.read_csv('数据.csv',encoding='gbk')
fig=px.sunburst(data,path=['洲','国'],values='奖牌数',color='奖牌数',color_continuous_scale='Bugn')
fig.update_traces(textinfo='label+value+percent root')
fig.show()