'Date Tick-marks (mm/dd) on Slider

I have added a slider to my plot.

ax2 = fig.add_axes([.1, .01, .8, .05])
ax2_Slider = Slider(ax2, 'NormDate', valmin, valmax,  valstep=1, color='w', initcolor='none', track_color='g')
ax2_Slider.valtext.set_visible(False)

In matplotlib, the slider values must be float, not date. Thus I used date2num to convert the dates values.

leftDate = datetime.date.today()  - relativedelta(days=366)
valmin = mpl.dates.date2num(leftDate)
valmax = mpl.dates.date2num(datetime.date.today())

How can I add tick marks to the slider to show mm/dd? Also how to add title showing which date is selected?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source