win10系统在plotly导出图片时程序卡死

在用plotly的write_image时,程序就像进入无限循环一样卡死了。下面是解决方案

pip install --upgrade "kaleido==0.1.*"

这样就能正常输出图片了

import plotly.express as px

df = px.data.iris()
'''注意这里的括号'''
fig=(px.scatter(
    df,
    x="sepal_width",
    y="sepal_length",
    color="species",
    facet_col="species",
    trendline="ols",
    title="Chaining Multiple Figure Operations With A Plotly Express Figure")
 .update_layout(title_font_size=24)
 .update_xaxes(showgrid=False)
 .update_traces(
     line=dict(dash="dot", width=4),
     selector=dict(type="scatter", mode="lines")))
fig.show()

fig.write_image('junpei.png',scale=3
                ,height=800,width=1200)

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值