Using latest matplotlib (0.91.1) and have two about date formatting.
The following two questions are put here in attempt to get a plot of a month
with days 1-31 neatly fit onto the x axis.
Using DateFormatter class to format dates and am confused as
to how to set the axis properties like font size and font family of the
xtick labels. The following type of thing (leaving out the most of the
code) does not work…
daysFmt = DateFormatter('%d') ax.xaxis.set_major_locator(days) ax.xaxis.set_major_formatter(daysFmt) ax.xaxis.set_minor_locator(days2) ax.autoscale_view() ax.set_xticklabels(xdates,family='serif', fontsize=8)
…because when I put that last line I do get the font size changed
but I lose the date formatting via DateFormatter. However if I put
only the .set_major_formatter(daysFmt) line, I get the right date
formatting…but how do I change the font?
- I want the plot to display, for example, the month of Jan,
with only days 1 - 31 shown on the x axis. But if I use the
DateFormatter (leaving out the .set_xticklabels line), for the date
range given (days 1-31) it includes a couple of days on either side
of the plot (the 31st from the previous month and a day or two into
the following month). How can I get it to display only 1-31? And if I
do, will the points plotted on day 1 and day 31 be halfway cut off
by th edges of the plot? (and is there any fix for that?)
Any help is appreciated.