【发布时间】:2021-07-01 09:48:00
【问题描述】:
我尝试运行这段代码,用 plotly express 生成一个图。
import plotly.express as px
df = pd.DataFrame([[1,1,1,0,0], [1,1,1,0,1],
[1,1,0,1,0], [0,1,1,1,1]])
##example by plotly
#https://plotly.com/python/facet-plots/
#fig = px.line(df, facet_col="company", facet_col_wrap=2)
fig = px.area(df, facet_col_wrap=2) #works but not as expected
#fig = px.area(df,facet_col="???", facet_col_wrap=2) #should be the solution, but "???" is missing
fig.show(renderer="browser")
plolty (https://plotly.com/python/facet-plots/) 的示例有一个带标签的标题(“company”),它是用 facet_col 调用的。 id 不知道如何为我的 df 标头插入标签。我希望像 plotly 中的示例一样绘制数据框。
【问题讨论】: