Reputation: 6940
Here is a code:
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Bar(
name='Group 1',
x=['Var 1', 'Var 2', 'Var 3'], y=[3, 6, 4],
error_y=dict(type='data', array=[1, 0.5, 1.5]),
width=0.15
))
fig.add_trace(go.Bar(
name='Group 2',
x=['Var 1', 'Var 2', 'Var 3'], y=[4, 7, 3],
error_y=dict(type='data', array=[0.5, 1, 2]),
width=0.15
))
fig.update_layout(barmode='group')
fig.show()
It works well and produces:
Question: How to change the length of the horizontal lines at the end of of error bars? I mean this ones:
Upvotes: 3
Views: 338
Reputation: 4743
You just need to set the width
parameter like this:
error_y=dict(type='data', array=[0.5, 1, 2], width=20)
After modifying that line for Group 2 in your code you can get for example:
You can see the reference for parameters under https://plotly.com/python/reference/
Upvotes: 2