Black Lives Matter. Please consider donating to Black Girls Code today.

Axis labelling: "tickson" set to "boundaries" does not work for "date" type

Hello everyone,

I seem to be running into an issue when I try to label the x-axis on my plots: I would like to format the axis so that it shows years between tick marks, not below tick marks => | 2017 | 2018 | 2019 | etc…

This is my code

fig.update_xaxes(
type=“date”,
tickformat=’%Y’
showgrid=False,
ticks=“inside”,
tickson=“boundaries”,
ticklen=10,
dtick=‘M12’
)

I assume tickson=“boundaries” should do the trick. It definitely works for type=“category”, but when type=“date”, the label (2017, 2018, 2019…) is placed in a standard way, immediately below the corresponding tick mark, not in-between tick marks.

Is there a fix to that? I would be fine adding an offset of 6 months between a tick mark and a label… but I am not sure how to do that either.

Thank you!
Berti30

Indeed, tickson doesn’t apply to date axes yet, but we’re working on it!

Thank you for the quick reply, it is much appreciated! :slight_smile:
I will stay tuned then.