Hi @Alexboiboi, thanks a lot for your help with this; I really appreciate it.
I now got what I wanted with this code
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
df = pd.read_excel("https://www.dropbox.com/s/za5e81lksyipztm/tips_2.xlsx?dl=1")
fig = px.strip(df, x='day', y='total_bill', color="day").update_traces(jitter = 1,
opacity=0.8,
marker_size=10,
marker_line_width=1)
# Group and calculate the mean and sem
mean = df.groupby('day').mean()
sem = df.groupby('day').sem()
# Add traces for mean and sem
fig.add_trace(
go.Scatter(
mode='markers',
x=dm.index, y=mean['total_bill'],
error_y_array=sem['total_bill'],
marker=dict(symbol='141', color='rgba(0,0,0,0.6)', size=30,
line=dict(width=2)
),
showlegend=False
)
)
# Customization of y-axis
#fig.update_yaxes(range=[0, 10])
# Figure layout
fig.update_layout(template='simple_white', width=400, height=500, title='Main Title', yaxis_title='Distance moved',
legend=dict(title='', itemclick='toggle', itemsizing='constant', traceorder='normal',
bgcolor='rgba(0,0,0,0)', x=1),
#margin=dict(color="black",width=3),
xaxis=dict(title='This is a title', showticklabels=True, ticks='outside', type='category')
)
# Make figure zoomable
config = dict({'scrollZoom':True})
fig.show(config=config)
I still donβt understand the difference between fig.add_scatter
and fig.add_trace
? The result, however, appears fine.