I am trying to generate a box plot using subsets of a larger data set. When I show the plot, there are strange gaps in the data. is there a way to center each plot over the correct label. Also, can I remove the redundant labels in the legend?
fig = go.Figure()
melted_data = melted_data.sort_values(['model', 'alpha'])
for model, alpha in zip(combos['model'].to_list(), combos['alpha'].to_list()):
data = melted_data[(melted_data.model == model) & (melted_data.alpha == alpha)]
fig.add_trace(go.Box(
y= data['value'],
x = data['model'],
marker_color=colors[alpha],
name = alpha,
boxmean=True,
alignmentgroup = 0
))
# print(i)
# i = i +1
fig.update_layout(
showlegend=True,
boxmode='group', # group together boxes of the different traces for each value of x
boxgap = .1)
fig.show()