O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Formatting axes' tick date labels using formatters

Formatting of axes' labels whose underlying data type is datetime is done using locators and formatters. Locators control the position of the ticks and formatters control the formatting of the labels.

matplotlib provides several classes in maptplotlib.dates to help facilitate the process:

  • MinuteLocator, HourLocator, DayLocator, WeekdayLocator, MonthLocator, and YearLocator
  • These are specific locators coded to determine where the ticks for each type of date field will be found on the axis
  • DateFormatter
  • This is a class that can be used to format date objects into labels on the axis

The default locator and formatter are AutoDateLocator and AutoDateFormatter. These can be changed by providing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required