Current project is to graph a series of time frames all normalised to the same even which happens at different time during the year, each year.
Each time cycle has a defined start and end which is stated in reference to an event within the cycle. In this case a company reports earnings during certain times of the year. The common event in each reporting cycle is that the company notifies when the financial reports are to be announced to the general public.
the distribution announcement has been deemed 'Day 0' and all other events within the cycle are graphed in realation to the announcement date. They happen 'x' days before or after the announcement date.
Matplotlib will automatically set the range using the min/max values in the data being graphed. I am trying to set the x tickers to be 5 apart with the Announcement Date (0) as the base
If I use:
ax.xaxis.set_major_locator(plt.IndexLocator(base=5, offset=0))
it does not use 'Day 0' in the cycle, but the first (0) position on the x axis as the offset and then puts the next ticker at 5 from that.
So, if the minimum start of the cycles in my dataset is at 53 days before the announcement date (my '0'), then it draws the first x-ticker at -53, the next one at -48,-43, etc. It does not center on my '0'. but the minimum x value.
Hoewever, If I draw a vertical line at my '0' using:
ax.vlines(0,-1,len(df))
it draws it in the correct location, but the only way the line matched a ticker of '0' is when the first ticker is a multiple of 5.
( In my example dataset where xmin = -53, the line is drawn between the -3 and 2 tickers.
How can I force the Locator to offset in the middle of the graph where my '0' is?
Or, can I force the first ticker to automatically glue itself to the nearest multiple of 5?