Whenever we create line plots, Matplotlib by default selects standard Coloring and Styling for plotting them. But if we want to choose our own colors and styles for our plots, we can surely do that.

Note: If no color is specified, Matplotlib will automatically cycle through a set of default colors for multiple lines.

We first import the Matplotlib library.

Coloring Line Plots

We can specify the color of line plots by following methods -

Specify color by name

Specify color by short color code - [rgbcmyk]

Grayscale color (values range from 0 to 1)

Specify color by Hex code

Specify color by RGB tuple

Styling Line Plots

We can style the line plots in the following ways-

Solid Line Style

Dashed Line Style

Dashdot Line Style

Dotted Line Style