Plotly:如何使用Plotly express设置错误条的宽度?

2024-09-23 10:32:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这段代码。我可以使用px.scatter编辑错误条的宽度吗

tab = pd.read_csv("hct.csv")
fig=px.scatter(tab, x="diametro", y="prof", color="s-c", trendline="ols",error_y="erro prof",error_x="erro diam", width=600, height=400)
fig.show()

Tags: csv代码编辑read宽度错误figerror
1条回答
网友
1楼 · 发布于 2024-09-23 10:32:00

您还没有指定宽度是否应该由一个数字变量设置,或者您只是想让每个错误条的行变宽一点。但实现后者的方法是,例如:

fig.data[0].error_y.thickness = 12

这将扭转这一局面:

enter image description here

为此:

enter image description here

不管你是用ploty.express还是plotly.graph_objects来塑造你的身材,这都无关紧要

完整代码:

相关问题 更多 >