Jul 09, 2026 — Digital Edition
George Ideas
Independent Journalism & Insight
Feature

Python Matplotlib Colors: The Ultimate List

Python's Matplotlib library is a powerful tool for data visualization, offering a wide range of colors to enhance your plots. Understanding the color options can help you create more engaging and informative visualizations. Let's explore the various ways to use colors in Matplotlib.

COLORS
COLORS

Before diving into the color list, it's essential to understand how Matplotlib represents colors. It uses a system based on RGB (Red, Green, Blue) and hexadecimal codes. Let's start by looking at the basic color names and their RGB equivalents.

List of named colors
List of named colors

Basic Colors in Matplotlib

Matplotlib provides a set of basic colors that can be directly used in your plots. These colors include 'b' (blue), 'g' (green), 'r' (red), 'c' (cyan), 'm' (magenta), 'y' (yellow), 'k' (black), and 'w' (white).

Colour chart for Tkinter and Tix
Colour chart for Tkinter and Tix

Here's a simple example demonstrating the use of basic colors:

```python import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 10, 100) plt.plot(x, np.sin(x), 'b-', label='Blue Line') plt.plot(x, np.cos(x), 'g--', label='Green Dash') plt.legend() plt.show() ```

Color Names

All Important Python Functions for Beginners (Complete Cheat Sheet)
All Important Python Functions for Beginners (Complete Cheat Sheet)

Matplotlib also supports a broader range of color names, including those defined by the X11 color names. You can use these names directly in your code, like so:

```python plt.plot(x, np.sin(x), color='darkgreen', label='Dark Green Line') ```

Hex Color Codes

You can also use hex color codes in Matplotlib. Hex codes are six-digit numbers preceded by a hash (#) that represent colors in the RGB color model. For example, '#008CBA' represents a shade of blue.

the color code for all kinds of colors
the color code for all kinds of colors

```python plt.plot(x, np.sin(x), color='#008CBA', label='Hex Blue Line') ```

Colormaps

Colormaps are useful when dealing with 2D data or images. They map data values to colors, allowing you to visualize the distribution of data. Matplotlib provides a variety of colormaps, such as 'viridis', 'plasma', and 'inferno'.

Here's an example using the 'viridis' colormap:

Tkinter
Tkinter

```python import matplotlib.pyplot as plt import numpy as np x, y = np.meshgrid(np.linspace(-3, 3, 200), np.linspace(-3, 3, 200)) z = (1 - x / 2 + y ** 5) * np.exp(-(x ** 2) - y ** 2) plt.imshow(z, cmap='viridis') plt.colorbar() plt.show() ```

Custom Colormaps

You can also create your own colormaps using the `LinearSegmentedColormap` class. This allows you to define a custom color gradient for your data.

a computer screen with a bar graph on it's left side and the text, colored bars using matplotib in python
a computer screen with a bar graph on it's left side and the text, colored bars using matplotib in python
How to construct a color map in seaborn from a list of RGB colors?
How to construct a color map in seaborn from a list of RGB colors?
the color chart for different colors and numbers
the color chart for different colors and numbers
5 Matplotlib Hacks for Better Python Charts
5 Matplotlib Hacks for Better Python Charts
Master Python List Methods 🐍 | Beginner-Friendly Cheat Sheet
Master Python List Methods 🐍 | Beginner-Friendly Cheat Sheet
Follow @CodeWithAdya for more Python notes, coding tips, and beginner-friendly content 💜 #Python
Follow @CodeWithAdya for more Python notes, coding tips, and beginner-friendly content 💜 #Python
Day 28: Matplotlib in Python 📊
Day 28: Matplotlib in Python 📊
an image of a colorful chart with different colors
an image of a colorful chart with different colors
a screenshot of the matplotib line chart for windows and macs
a screenshot of the matplotib line chart for windows and macs
Python Cheat Sheet for Beginners 2026 | Python Basics, Syntax, Loops, Functions & Variables
Python Cheat Sheet for Beginners 2026 | Python Basics, Syntax, Loops, Functions & Variables
Python List Comprehension Cheat Sheet 📌
Python List Comprehension Cheat Sheet 📌
List of named colors
List of named colors
a black background with text that reads python lists method, and an image of a computer screen
a black background with text that reads python lists method, and an image of a computer screen
Python Cheat Sheet for Beginners
Python Cheat Sheet for Beginners
Python List Methods
Python List Methods
Data Visualization using Matplotlib
Data Visualization using Matplotlib
Python Lists infographic for beginners
Python Lists infographic for beginners
Python List Sorting!!
Python List Sorting!!
the cover of collection data types in python, with an image of numbers and symbols
the cover of collection data types in python, with an image of numbers and symbols
Python list exercises guide
Python list exercises guide

In conclusion, understanding the color options in Matplotlib can help you create more engaging and informative visualizations. Whether you're using basic color names, hex codes, or custom colormaps, there's a wealth of possibilities to explore. So go ahead, experiment, and make your plots pop!