Home > Mobile >  How to get lines in matplotlib plot to continue past x-axis limit (python)
How to get lines in matplotlib plot to continue past x-axis limit (python)

Time:10-05

My goal is to plot lines that represent certain days of the year. Note: I do not want to use a package like date time -- I am just trying to do this with the data points as integer values. So in the plot below, the event at y=3 lasts between day 123 to 189 and event at y=2 lasts between days 214 and 365.

Where I run into problems is with event at y=1, which should go from day 205 to 22 (that's what's in the data dataframe). However, the plot does not know that I am plotting days of the year (obviously) and so it stretches from day 0 to 205, which is wrong. Instead, it should start at 205, stretch to the right and then end at the value of 22. I've hand drawn in blue what it should look like.

enter image description here

  • Related