# Box plot with gaps in categores

**URL:** <https://community.plotly.com/t/box-plot-with-gaps-in-categores/44825>\
**Category:** 📊 Plotly Python\
**Created:** [September 12, 2020, 4:43pm UTC](https://community.plotly.com/t/box-plot-with-gaps-in-categores/44825 "2020-09-12T16:43:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zygonyx](https://avatars.discourse-cdn.com/v4/letter/z/da6949/32.png) [@Zygonyx](https://community.plotly.com/u/Zygonyx)\
**Post date:** [September 12, 2020, 4:43pm UTC](https://community.plotly.com/t/box-plot-with-gaps-in-categores/44825/1 "2020-09-12T16:43:14Z")

</div>

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?

```auto
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()

```

 ![newplot (8)](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/9/95780dc7a06f18b0f0097c9898ebfcb0d2f890b6.png)
