I want to create a plot where the y-axis is the number of seasonal years I have data for and the x-axis is in months and days. Each seasonal year will have two dates.
|1957|...
|1956| d1--------d2
|1955| d1---------d2
|1954| d1---------d2
|June01|...|Jan01...|Feb11|...|Feb23|...|Feb26|...|Mar20|...|Mar25|..
I almost have the graph I want, except the x-axis covers the entire time span rather than just 12-months.
from bokeh.plotting import figure
p1 = figure(plot_width=1000, plot_height=300, x_axis_type="datetime")
p1.circle(merged.date1, merged.index, color = 'red', legend = 'Date1')
p1.circle(merged.date2, merged.index, color = 'green', legend = 'Date2')
show(p1)
I have been trying to strip the year from the date and still plot it as a date. The first line below works, but because of the leap years the second line returns an error in the real data (day is out of range for month).
df_snw['Date1'] = df_snw['Date1'].map(lambda x: x.strftime('%m-%d'))
df_snw = pd.to_datetime(df_snw['Date1'], format='%m-%d')
I would convert your date1 and date2 to
day of the year
for the xaxis and re-label the x ticks as the months. This way all the data is overlayed on a 1 to 365 xaxis scale.