What is the default color for Matplotlib plots?

2023

What is the default color for Matplotlib plots?

Answer: A. BlueAnswer: Blue — Matplotlib uses blue as the default color for line plots, and it is the first color in the default color cycle. Default color details: The…

  1. A.

    Blue

  2. B.

    Green

  3. C.

    Black

  4. D.

    Red

Attempted by 1905 students.

Show answer & explanation

Correct answer: A

Answer: Blue — Matplotlib uses blue as the default color for line plots, and it is the first color in the default color cycle.

Default color details: The specific color is referred to as 'tab:blue', and its hex code is #1f77b4.

To change the color for a single plot, pass the color argument, for example plt.plot(x, y, color='green') or plt.plot(x, y, color='g').

To change the global default, modify matplotlib.rcParams, for example by updating 'axes.prop_cycle' to a different color cycle.

Explore the full course: Bpsc

Loading lesson…