Using Python with %pylab (Matplotlib & Numpy). Need a very particular xtick label layout consisting of 3 rows, the first of which has a different orientation to the rest. This is a mock up below.
I can add multiple lines to the xlabel using '/n' so can add the weekday & date on to the first label of each day on different lines. The problem is the orientation. The time element {9am, 10am, 11am...} needs to be rotated vertically (it does improve legibility), whereas the weekday and date element needs to remain horizontal.
This is some code that constructs the labels
def day_time_xlabels(lst, expand_on_time='9:00 AM', ignore_on_time='5:00 PM'):
labels = []
for l in lst:
if l[1]==expand_on_time:
labels+=[l[1] + '/n/n' + l[0].strftime('%A') + '/n/n'+ l[0].strftime('%d %b %y')]
elif l[1]==ignore_on_time:
labels+=['']
else:
labels+=[l[1]]
return labels
Any ideas on the rotation? Or whether it is possible for me to have multiple xlabels?
I have considered ConciseDateFormatter (https://matplotlib.org/stable/api/dates_api.html#matplotlib.dates.ConciseDateFormatter) but this still does not give me enough control ovel the rotation.
My fall back ideas are to have a subplot without a graph so just the axis labels show, or to construct the labels as a separate html/css piece and overlay that as an image maybe.
I'd appreciate any ideas, please.
Many thanks