[英]plotly express sunburst plot complete blank
I'm trying to plot a sunburst with plotly express, but the output is a complete blank plot.我正在尝试用 plotly 快递 plot 一个旭日形首饰,但是 output 是一个完整的空白 Z32FA6E1B78A54D4A2028 The code below is from an example showed on the plotly site .
下面的代码来自plotly 站点上显示的示例。 All the examples with
path
give me this output.所有带有
path
的示例都给了我这个 output。
import plotly.express as px
df = px.data.tips()
fig = px.sunburst(df, path=['day', 'time', 'sex'], values='total_bill')
fig.show()
Do you have some negative values in your 'total_bill' field?您的“total_bill”字段中是否有一些负值?
I found that Sunburst plot returns a blank if the column specified by the 'values' has some negative values.我发现如果“值”指定的列有一些负值,Sunburst plot 会返回空白。 When I drop rows with negative values, the chart renders fine.
当我删除具有负值的行时,图表呈现良好。 I don't know if this is a bug though.
我不知道这是否是一个错误。
I'm running Plotly 5.4.0/Python 3.8.10 in WSL2 on Windows 10.我在 Windows 10 上的 WSL2 中运行 Plotly 5.4.0/Python 3.8.10。
You are not providing valid data.您没有提供有效数据。 This is what it should be
这是应该的
import plotly.express as px
data = dict(
character=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
parent=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
value=[10, 14, 12, 10, 2, 6, 6, 4, 4])
fig = px.sunburst(
data,
names='character',
parents='parent',
values='value',
)
fig.show()
Enjoy!享受!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.