Kajo
Kajo

Reputation: 185

Plotly: How to set the width of error bars using plotly express?

I have this piece of code. Can I edit the width of error bars using 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()

Upvotes: 3

Views: 2157

Answers (1)

vestland
vestland

Reputation: 61154

You haven't specified whether the width should be set by a numeric variable or if you'd just like to make the line for each error bar a bit wider. But the way to do the latter is, for example:

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

That will turn this:

enter image description here

Into this:

enter image description here

And it won't matter whether you've built your figure using ploty.express or plotly.graph_objects

Complete code:

Upvotes: 3

Related Questions