How Do I Show Major Ticks As The First Day Of Each Months And Minor Ticks As Each Day?
I tried to follow the matplotlib documentation to create price-volume plot for stocks. I have a question about how to set the major ticks to the first day of each month and minor t
Solution 1:
Just for posterity:
import matplotlib.dates as dt
import matplotlib.ticker as ticker
ax.xaxis.set_major_locator(dt.MonthLocator())
ax.xaxis.set_major_formatter(dt.DateFormatter('%d %b'))
ax.xaxis.set_minor_locator(dt.DayLocator())
ax.xaxis.set_minor_formatter(ticker.NullFormatter())
Post a Comment for "How Do I Show Major Ticks As The First Day Of Each Months And Minor Ticks As Each Day?"