问题描述
以下可重现的示例:
import plotly.express as px
import numpy as np
df = px.data.gapminder().query("year == 2007")
df["world"] = "world" # in order to have a single root node
fig = px.treemap(df,path=['world','continent','country'],values='pop',color='lifeExp',hover_data=['iso_alpha'],color_continuous_scale='RdBu',color_continuous_midpoint=np.average(df['lifeExp'],weights=df['pop']))
fig.show()
尝试:
fig.update_layout(legend=dict(
orientation="h",yanchor="bottom",y=1.02,xanchor="right",x=1
))
不知道为什么上面的方法不起作用?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)