I’m plotting quarterly observations. Dates stored as <class ‘numpy.int64’> are converted pd.to_datetime to get datetime such as Timestamp(‘2022-12-31 00:00:00’) for the last day of Q4 2022
When plotting, dash shows Jan 2023 rather than Dec 2022
Is there a way to show Dec 2022, or, even better, Q4 '22 ', without modifying the data?
Basically just plot 1 point with a timestamp as x and random value as y:
import plotly.graph_objs as go
import pandas as pd
import plotly.io as pio
x=pd.to_datetime([20221231, 20230331], format="%Y%m%d"),
I had already boiled down the problem to the minimum, textually
I also notice that the labelson the xaxis don’t exactly appear below the datapoint. The xaxis being a datetime, it is labelled at “random interval”. Seems to be the cause of the issue here; I would like the tick label to appear online where the x value of the data point is also a tick. In other word, that my ticks become the quarters end.
haha yes, that was the solution I was woriking on, right now, I found the hint in the last sentence of dtick formatting: " To set ticks on the 15th of every third month, set tick0 to “2000-01-15” and dtick to “M3”. To set ticks every 4 years, set dtick to “M48"”
Thanks for the link to the examples. Might be useful for the next charts.