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

Specifying line colors, styles, thickness, and markers

pandas automatically sets the colors of each series on any chart. To specify your own colors, supply style codes to the style parameter of the plot function. pandas has a number of built-in single-character codes for colors, several of which are listed here:

  • b: Blue
  • g: Green
  • r: Red
  • c: Cyan
  • m: Magenta
  • y: Yellow
  • k: Black
  • w: White

It is also possible to specify the color using a hexadecimal RGB code in #RRGGBB format. The following example demonstrates both by setting the color of the first series to green using a single-digit code and the second series to red using the RGB hexadecimal code:

Line styles can be specified by using a line style code. These can be used in combination with ...

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