Bar chart with very thin bars

Hello all,
my problem is that when I view my bar chart, the bars appear very thin and you can hardly see them.

i have this >>

and this is my sample code:

df_test = pd.read_csv('test_data.csv')
media = round(df_test["ok"].mean())
title = "Cantidad por producciones (OK medio = {})".format(media)
fig = px.bar(df_test,
                x = 'inicio',
                y="ok",
                hover_data=['id', 'inicio', 'ok', 'nok'],
                color='maquina',
                title=title)

fig.add_hline(y=media, line_color='darkblue', line_width=2, line_dash="dot", opacity=0.5)

fig.update_layout(showlegend=True,
                      hoverlabel_align = 'right',
                      xaxis_title= None,
                      yaxis_title= None,
                      hovermode="x unified",
                      plot_bgcolor="#f9f9f9",
                      paper_bgcolor="#f9f9f9",
                      margin=dict(l=30, r=0, t=30, b=10)
    )

Hey @gabino.alonso

Try experimenting with the width property of the bar component.

fig.update_traces(width=1)

It should work… If not, do not hesitate to ask again!

Cheers!

See also:

Related:

Thanks to both of you, I’m going to try it and share my experience.

1 Like

Just for information:
If using a time axis, the width has to be specified in milliseconds :raised_hands: