In matplotlib versions >= 1.5, you can print the rcParam called axes.prop_cycle:

print(plt.rcParams['axes.prop_cycle'].by_key()['color'])

# [u'#1f77b4', u'#ff7f0e', u'#2ca02c', u'#d62728', u'#9467bd', u'#8c564b', u'#e377c2', u'#7f7f7f', u'#bcbd22', u'#17becf']

Or equivalently, in python2:

print plt.rcParams['axes.prop_cycle'].by_key()['color']

In versions < 1.5, this was called color_cycle:

print plt.rcParams['axes.color_cycle']

# [u'b', u'g', u'r', u'c', u'm', u'y', u'k']

Note that the default color cycle changed in version 2.0.0 http://matplotlib.org/users/dflt_style_changes.html#colors-in-default-property-cycle

Answer from tmdavison on Stack Overflow
🌐
Matplotlib
matplotlib.org › stable › gallery › color › color_cycle_default.html
Colors in the default property cycle — Matplotlib 3.11.2 documentation
Display the colors from the default prop_cycle, which is obtained from the rc parameters. import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import TABLEAU_COLORS, same_color def f(x, a): """A nice sigmoid-like parametrized curve, ending approximately at *a*.""" return 0.85 * a * (1 / (1 + np.exp(-x)) + 0.2) fig, ax = plt.subplots() ax.axis('off') ax.set_title("Colors in the default property cycle") prop_cycle = plt.rcParams['axes.prop_cycle'] colors = prop_cycle.by_key()['color'] x = np.linspace(-4, 4, 200) for i, (color, color_name) in enumerate(zip(colors, TABLEAU_COLORS)): assert same_color(color, color_name) pos = 4.5 - i ax.plot(x, f(x, pos)) ax.text(4.2, pos, f"'C{i}': '{color_name}'", color=color, va="center") ax.bar(9, 1, width=1.5, bottom=pos-0.5) plt.show()
Discussions

python - Get default line color cycle - Stack Overflow
Is there some way to access this list of colors? I've seen a million posts on how to change the color cycle or access the iterator, but not on how to just get the list of colors that matplotlib cycles through by default. More on stackoverflow.com
🌐 stackoverflow.com
&quot;What is the default color for Matplotlib&nbsp;plots?&quot;
The correct answer is Blue. Key Points Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. More on testbook.com
🌐 testbook.com
1
1322
2 weeks ago
python - matplotlib: specify default colors explicitly - Stack Overflow
I am not sure if I understand your ... for the default color cycle which can be found here. You say that · @JodyKlymak: but then if I have many plots, some of them will be in the same color. I don't think this happens when I do not specify the color explicitly. This is not a correct assumption. It is a color cycle, so the colors will repeat. import matplotlib.pyplot as ... More on stackoverflow.com
🌐 stackoverflow.com
Changing default colors of matplotlib for scatterplot
I think this is what your looking for: http://matplotlib.org/users/customizing.html More on reddit.com
🌐 r/learnpython
10
10
October 14, 2016
🌐
Statology
statology.org › home › a complete guide to the default colors in matplotlib
A Complete Guide to the Default Colors in Matplotlib
July 17, 2022 - Or if you create a plot in Matplotlib with two lines, the color of the first line will be #1f77b4 and the color of the second line will be #ff7f0e unless you specify otherwise. Refer to the Matplotlib documentation for a complete explanation of the default colors.
🌐
Wordpress
statisticaloddsandends.wordpress.com › 2023 › 05 › 24 › getting-matplotlibs-default-colors
Getting matplotlib’s default colors | Statistical Odds & Ends
May 27, 2023 - Notice that the first and the 11th line have the same color. That’s because matplotlib only has 10 default colors.
Top answer
1 of 4
217

In matplotlib versions >= 1.5, you can print the rcParam called axes.prop_cycle:

print(plt.rcParams['axes.prop_cycle'].by_key()['color'])

# [u'#1f77b4', u'#ff7f0e', u'#2ca02c', u'#d62728', u'#9467bd', u'#8c564b', u'#e377c2', u'#7f7f7f', u'#bcbd22', u'#17becf']

Or equivalently, in python2:

print plt.rcParams['axes.prop_cycle'].by_key()['color']

In versions < 1.5, this was called color_cycle:

print plt.rcParams['axes.color_cycle']

# [u'b', u'g', u'r', u'c', u'm', u'y', u'k']

Note that the default color cycle changed in version 2.0.0 http://matplotlib.org/users/dflt_style_changes.html#colors-in-default-property-cycle

2 of 4
198

Often, there is no need to get the default color cycle from anywhere, as it is the default one, so just using it is sufficient.

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

t = np.arange(5)

for i in range(4):
    line, = ax.plot(t,i*(t+1), linestyle = '-')
    ax.plot(t,i*(t+1)+.3,color = line.get_color(), linestyle = ':')

plt.show()

In case you want to use the default color cycle for something different, there are of course several options.

"tab10" colormap

First it should be mentionned that the "tab10" colormap comprises the colors from the default color cycle, you can get it via cmap = plt.get_cmap("tab10").

Equivalent to the above would hence be

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

t = np.arange(5)
cmap = plt.get_cmap("tab10")
for i in range(4):
    ax.plot(t,i*(t+1),   color=cmap(i), linestyle = '-')
    ax.plot(t,i*(t+1)+.3,color=cmap(i), linestyle = ':')

plt.show()

Colors from color cycle

You can also use the color cycler directly, cycle = plt.rcParams['axes.prop_cycle'].by_key()['color']. This gives list with the colors from the cycle, which you can use to iterate over.

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

t = np.arange(5)
cycle = plt.rcParams['axes.prop_cycle'].by_key()['color']

for i in range(4):
    ax.plot(t,i*(t+1),   color=cycle[i], linestyle = '-')
    ax.plot(t,i*(t+1)+.3,color=cycle[i], linestyle = ':')

plt.show()

The CN notation

Finally, the CN notation allows to get the Nth color of the color cycle, color="C{}".format(i). This however only works for the first 10 colors (N in [0,1,...9])

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

t = np.arange(5)

for i in range(4):
    ax.plot(t,i*(t+1),   color="C{}".format(i), linestyle = '-')
    ax.plot(t,i*(t+1)+.3,color="C{}".format(i), linestyle = ':')

plt.show()

All codes presented here produce the same plot.

🌐
Robin's Blog
blog.rtwilson.com › easily-specifying-colours-from-the-default-colour-cycle-in-matplotlib
Easily specifying colours from the default colour cycle in matplotlib « Robin's Blog
November 14, 2019 - To get the colours in the default colour cycle you can simply use the strings 'C0', 'C1', 'C2' etc. So, in this case just · plt.fill_between(x_values, line2 - 5, line2 + 5, alpha=0.3, color='C1') The result looks far better now the colours match: I found out about this from a wonderful graphical ...
🌐
Arab Psychology
scales.arabpsychology.com › home › how to easily find and use matplotlib’s default colors
How To Easily Find And Use Matplotlib's Default Colors
November 28, 2025 - The default colors in Matplotlib are not randomly chosen; they are part of a carefully curated palette designed for visual distinctness and accessibility. Knowing this sequence—which includes the underlying RGB codes, names, and hexadecimal representations—allows users to predict the appearance of their plots without manual specification.
Find elsewhere
🌐
Matplotlib
matplotlib.org › 3.1.1 › gallery › color › color_cycle_default.html
Colors in the default property cycle — Matplotlib 3.1.2 documentation
Display the colors from the default prop_cycle, which is obtained from the rc parameters. import numpy as np import matplotlib.pyplot as plt prop_cycle = plt.rcParams['axes.prop_cycle'] colors = prop_cycle.by_key()['color'] lwbase = plt.rcParams['lines.linewidth'] thin = lwbase / 2 thick = lwbase * 3 fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True) for icol in range(2): if icol == 0: lwx, lwy = thin, lwbase else: lwx, lwy = lwbase, thick for irow in range(2): for i, color in enumerate(colors): axs[irow, icol].axhline(i, color=color, lw=lwx) axs[irow, icol].axvline(i, color=c
🌐
Stack Overflow
stackoverflow.com › questions › 70792442 › matplotlib-specify-default-colors-explicitly
python - matplotlib: specify default colors explicitly - Stack Overflow
If you want to cycle through the colors manually, just get the list of default colors and use the modulo operator as follows. import matplotlib.pyplot as plt prop_cycle = plt.rcParams['axes.prop_cycle'] colors = prop_cycle.by_key()['color'] num_plots = 20 for i in range(num_plots): plt.plot([0,1], [(i+1)/num_plots, (i+1)/num_plots], color=colors[i % len(colors)]) plt.show()
🌐
StrataScratch
stratascratch.com › blog › how-to-customize-matplotlib-colors-for-better-plots
How to Customize Matplotlib Colors for Better Plots? - StrataScratch
February 24, 2025 - In the code below, you see how we use the plot() function from Matplotlib’s pyplot. First, we specify the columns we want to plot, which are month on the x-axis and growth_rate on the y-axis. Next, we define the line color by setting the color parameter to 'blue'. The line width is 2, which is thicker than the default of 1.5.
🌐
Matplotlib
matplotlib.org › stable › release › prev_whats_new › dflt_style_changes.html
Changes to the default style — Matplotlib 3.11.2 documentation
January 17, 2017 - Previously, the default colors were the single character short-hand notations for red, green, blue, cyan, magenta, yellow, and black. This made them easy to type and usable in the abbreviated style string in plot, however the new default colors are only specified via hex values.
🌐
Petercbsmith
petercbsmith.github.io › color-tutorial.html
Plotting with Pride: colors in matplotlib
matplotlib also has a built-in color cycle that is more accessible for those with color vision deficiency. You can use it by using the tableau-colorblind10 style sheet: ... You may also be familiar with setting colormaps, such as when using the imshow function. The default is called "viridis", but there are many built-in colormaps in matplotlib.
🌐
Reddit
reddit.com › r/learnpython › changing default colors of matplotlib for scatterplot
r/learnpython on Reddit: Changing default colors of matplotlib for scatterplot
October 14, 2016 -

So I'm making a scatterplot where in we plot A vs B and then based on a third variable (which is either, 0, 1, 2, 3 or 4) the dot on the graph has a different color. But one of the colors is yellow... which sucks for white backgrounds.

So I want to change the default colors picked by matplotlib that are assigned to each value of the third variable. The only thing I could find so far is to change the colormap with cmap=cm.xxx but that doesn't really work for me, since most cmaps still have yellow in it, or have just generally ugly colors.

So how do I change the default colors?

plt.scatter(df['A'],df['B'], s=5, c=df['third_variable'], edgecolors=(1,1,1,0))
🌐
Matplotlib
matplotlib.org › stable › users › prev_whats_new › dflt_style_changes.html
Changes to the default style
January 17, 2017 - Specifying colors · Text · Annotations · Fonts in Matplotlib · Writing mathematical expressions · Text rendering with XeLaTeX/LuaLaTeX via the pgf backend · Text in Matplotlib · Text properties and layout · Default Font · Text rendering with LaTeX ·
🌐
Matplotlib
matplotlib.org › 2.0.2 › users › colors.html
Specifying Colors — Matplotlib 2.0.2 documentation
one of {'tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'} which are the Tableau Colors from the ‘T10’ categorical palette (which is the default color cycle). All string specifications of color are case-insensitive.
🌐
Matplotlib
matplotlib.org › 3.1.3 › gallery › color › color_cycle_default.html
Colors in the default property cycle — Matplotlib 3.1.3 documentation
Display the colors from the default prop_cycle, which is obtained from the rc parameters. import numpy as np import matplotlib.pyplot as plt prop_cycle = plt.rcParams['axes.prop_cycle'] colors = prop_cycle.by_key()['color'] lwbase = plt.rcParams['lines.linewidth'] thin = lwbase / 2 thick = lwbase * 3 fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True) for icol in range(2): if icol == 0: lwx, lwy = thin, lwbase else: lwx, lwy = lwbase, thick for irow in range(2): for i, color in enumerate(colors): axs[irow, icol].axhline(i, color=color, lw=lwx) axs[irow, icol].axvline(i, color=c