Remove years with decimal numbers on image

I’m creating a image that have three different years on data: 2021, 2022, 2023. But when I plot the image this is the output:
image

these 2.021.5, 2.022.5 doesnt make sense since i’m using years and there is no data with these years, any way to remove it from image?

the current code is something like it:

fig = go.Figure()
for i in range(len(tabela["tags"])):
    if colors:
        fig.add_trace(go.Bar(x=tabela.get("anos"), y=tabela.get("quantidade")[i], name=tabela["tags"][i], marker_color=colors.pop(0)))
    else:
        fig.add_trace(go.Bar(x=tabela.get("anos"), y=tabela.get("quantidade")[i], name=tabela["tags"][i]))
fig.update_layout(xaxis_title="Ano", yaxis_title="Quantidade")
fig.update_layout(barmode='stack')
fig.update_xaxes(categoryorder='category ascending')
img_name = f"{str(board_id)}-{datetime.utcnow().strftime('%Y%m%d%H%M%SZ')}-{random.randint(0, 1000)}.svg"
fig.write_image(f"images/{img_name}")

You have two options. Define your X-axis as type time. Define your X-axis as type categorical.

See also

1 Like

Awesome, worked perfectly

1 Like