Add the mean in box plots with plotly express?


I have the following figure:

Box plot from plotly express

and I would like to add the mean.

Is it possible with Plotly Express, without using Graph Objects go.Box()?

For information, here is my code:

import as px
fig =, 
		# boxmean=True,

and the pandas DataFrame:

method	group	patient	device_field_strength	variable	value
expert1	experts	62	device_field_strength_1.5	F1_score	0.857
expert1	experts	66	device_field_strength_3	    F1_score	0.909
...	...	...	...	...	...	...

Note: I made the same figure with Graph Objects but I donโ€™t know how to handle the legend and x labels.

You can add the averages by adding, after the graph, the settings for the averages you have already tried.

fig = 
1 Like

Wow! That was easy! It should be added in the documentationโ€ฆ Thanks!

1 Like