๐ŸŒ
Analytics Vidhya
analyticsvidhya.com โ€บ home โ€บ cmap in python: tutorials & examples | colormaps in matplotlib (updated 2026)
Cmap in Python: Tutorials & Examples | Colormaps in Matplotlib (Updated 2026)
January 2, 2026 - First, you can combine two Sequential colormaps in matplotlib colormap. Second, you can choose and combine your favorite color in RGB to create colormaps. We will give you a demo of combining two Sequential colormaps to create a new colormap.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ matplotlib-pyplot-set_cmap-in-python
Matplotlib.pyplot.set_cmap() in Python - GeeksforGeeks
July 12, 2025 - Matplotlib.pyplot.set_cmap() is a function in matplotlib that is used to set the default colormap for the current image or plot.
People also ask

Which Matplotlib colormap should I use?
Use sequential for ordered magnitude, diverging for a meaningful midpoint, cyclic for wraparound values, and qualitative for unordered categories.
๐ŸŒ
pythonpool.com
pythonpool.com โ€บ home โ€บ matplotlib โ€บ matplotlib cmap: sequential, diverging, cyclic, and qualitative
Matplotlib cmap: Sequential, Diverging, Cyclic, and Qualitative
How many colormaps does Matplotlib have?
Matplotlib 3.11 registers 182 colormap names. That is about 91 distinct maps plus a reversed _r twin of each; the gallery on this page lists 87 once British-spelling duplicates such as grey and gist_grey are removed. They are grouped into perceptually uniform sequential, sequential, sequential (2), diverging, cyclic, qualitative, and miscellaneous families.
๐ŸŒ
docs.kanaries.net
docs.kanaries.net โ€บ topics โ€บ Matplotlib โ€บ examples-matplotlib-cmaps
Matplotlib Colormaps: Interactive Explorer and Complete Gallery ...
How do I reverse a colormap in Matplotlib?
Append _r to the name, for example cmap='viridis_r' or cmap='RdBu_r'. Every built-in colormap has a reversed twin. Programmatically you can also call plt.get_cmap('viridis').reversed().
๐ŸŒ
docs.kanaries.net
docs.kanaries.net โ€บ topics โ€บ Matplotlib โ€บ examples-matplotlib-cmaps
Matplotlib Colormaps: Interactive Explorer and Complete Gallery ...
๐ŸŒ
Python Pool
pythonpool.com โ€บ home โ€บ matplotlib โ€บ matplotlib cmap: sequential, diverging, cyclic, and qualitative
Matplotlib cmap: Sequential, Diverging, Cyclic, and Qualitative
July 13, 2026 - For most everyday plots, start with a built-in colormap and simple alpha settings. If the background itself needs styling, see Matplotlib background color. If you are exporting the result, use the refreshed Matplotlib savefig() guide.
๐ŸŒ
Kanaries
docs.kanaries.net โ€บ topics โ€บ Matplotlib โ€บ examples-matplotlib-cmaps
Matplotlib Colormaps: Interactive Explorer and Complete Gallery โ€“ Kanaries
August 19, 2026 - Any plotting call that takes a c= or a 2D array also takes cmap=, and you set it by name: import matplotlib.pyplot as plt plt.imshow(data, cmap="viridis") # heatmaps, images, 2D arrays plt.scatter(x, y, c=values, cmap="plasma") # color encodes a third variable plt.colorbar() # always add this so the colors are readable
๐ŸŒ
Python Graph Gallery
python-graph-gallery.com โ€บ the python graph gallery โ€บ colors โ€บ how to use colormap in matplotlib
How to use Colormap in Matplotlib
2 weeks ago - In practice, we establish a mapping between the categories and the integers, then utilize the cmap object to translate these integers into colors. ... import matplotlib.pyplot as plt import numpy as np import matplotlib.colors as mcolors # Generate ...
๐ŸŒ
Seaborn
deeplearningnerds.com โ€บ matplotlib-color-maps
Matplotlib - Colormaps
December 15, 2023 - #plot 1 - magma plt.subplot(2, 3, 1) plt.scatter(x, y, c=colors, cmap='magma') plt.colorbar() plt.title('magma') #plot 2 - viridis plt.subplot(2, 3, 2) plt.scatter(x, y, c=colors, cmap='viridis') plt.colorbar() plt.title('viridis') #plot 3 - plasma plt.subplot(2, 3, 3) plt.scatter(x, y, c=colors, cmap='plasma') plt.colorbar() plt.title('plasma') #plot 4 - inferno plt.subplot(2, 3, 4) plt.scatter(x, y, c=colors, cmap='inferno') plt.colorbar() plt.title('inferno') #plot 5 - cividis plt.subplot(2, 3, 5) plt.scatter(x, y, c=colors, cmap='cividis') plt.colorbar() plt.title('cividis') plt.tight_layout() plt.show() Congratulations! Now you are one step closer to become an AI Expert. You have seen that it is very easy to use Colormaps provided by Matplotlib.
๐ŸŒ
Matplotlib
matplotlib.org โ€บ stable โ€บ tutorials โ€บ colors โ€บ colormap-manipulation.html
Creating Colormaps in Matplotlib โ€” Matplotlib 3.7.2 documentation
May 1, 2020 - # my_cmap, my_cmap_r from reversing a colormap mpl.colormaps.register(cmap=my_cmap) mpl.colormaps.register(cmap=my_cmap_r) data = [[1, 2, 3, 4, 5]] fig, (ax1, ax2) = plt.subplots(nrows=2) ax1.imshow(data, cmap='my_cmap') ax2.imshow(data, cmap='my_cmap_r') plt.show()
๐ŸŒ
Matplotlib
matplotlib.org โ€บ stable โ€บ users โ€บ explain โ€บ colors โ€บ colormap-manipulation.html
Creating Colormaps in Matplotlib โ€” Matplotlib 3.11.2 documentation
# my_cmap, my_cmap_r from reversing a colormap mpl.colormaps.register(cmap=my_cmap) mpl.colormaps.register(cmap=my_cmap_r) data = [[1, 2, 3, 4, 5]] fig, (ax1, ax2) = plt.subplots(nrows=2) ax1.imshow(data, cmap='my_cmap') ax2.imshow(data, cmap='my_cmap_r') plt.show()
Find elsewhere
๐ŸŒ
Matplotlib
matplotlib.org โ€บ stable โ€บ users โ€บ explain โ€บ colors โ€บ colormaps.html
Choosing Colormaps in Matplotlib โ€” Matplotlib 3.11.2 documentation
# Default is 6 colormaps per subplot. dsub = _DSUBS.get(cmap_category, 6) nsubplots = int(np.ceil(len(cmap_list) / dsub)) # squeeze=False to handle similarly the case of a single subplot fig, axs = plt.subplots(nrows=nsubplots, squeeze=False, figsize=(7, 2.6*nsubplots)) for i, ax in enumerate(axs.flat): locs = [] # locations for text labels for j, cmap in enumerate(cmap_list[i*dsub:(i+1)*dsub]): # Get RGB values for colormap and convert the colormap in # CAM02-UCS colorspace.
๐ŸŒ
Python Graph Gallery
python-graph-gallery.com โ€บ the python graph gallery โ€บ colors โ€บ create and customise palettes in matplotlib
Create and customise palettes in Matplotlib
2 weeks ago - from matplotlib.colors import ListedColormap # Define your custom color palette custom_colors = ['#264653', '#2a9d8f', '#e9c46a', '#f4a261', '#e76f51'] # Create a ListedColormap custom_cmap = ListedColormap(custom_colors) custom_cmap
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ matplotlib-colors-colormap-class-in-python
Matplotlib Colormaps - GeeksforGeeks
December 23, 2024 - import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LinearSegmentedColormap colors = ["blue", "green", "yellow"] cmap = LinearSegmentedColormap.from_list("CustomCmap", colors) data = np.random.randn(10, 10) ...
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ matplotlib โ€บ matplotlib_colormaps.htm
Matplotlib - ColorMaps
import matplotlib as mpl from matplotlib.colors import LinearSegmentedColormap import matplotlib.pyplot as plt import numpy as np # Creating a LinearSegmentedColormap from a list colors = ["rosybrown", "gold", "lawngreen", "linen"] cmap_from_list ...
๐ŸŒ
Matplotlib
matplotlib.org โ€บ 3.1.1 โ€บ tutorials โ€บ colors โ€บ colormap-manipulation.html
Creating Colormaps in Matplotlib โ€” Matplotlib 3.1.2 documentation
top = cm.get_cmap('Oranges_r', 128) bottom = cm.get_cmap('Blues', 128) newcolors = np.vstack((top(np.linspace(0, 1, 128)), bottom(np.linspace(0, 1, 128)))) newcmp = ListedColormap(newcolors, name='OrangeBlue') plot_examples([viridis, newcmp])
๐ŸŒ
Matplotlib
matplotlib.org โ€บ 3.1.0 โ€บ tutorials โ€บ colors โ€บ colormap-manipulation.html
Creating Colormaps in Matplotlib โ€” Matplotlib 3.1.0 documentation
May 18, 2019 - top = cm.get_cmap('Oranges_r', 128) bottom = cm.get_cmap('Blues', 128) newcolors = np.vstack((top(np.linspace(0, 1, 128)), bottom(np.linspace(0, 1, 128)))) newcmp = ListedColormap(newcolors, name='OrangeBlue') plot_examples([viridis, newcmp])
๐ŸŒ
Python-Fiddle
python-fiddle.com โ€บ tutorials โ€บ matplotlib-colormaps
Understanding and Using Matplotlib Colormaps in Data Science
import numpy as np import matplotlib.pyplot as plt # Sample Data data = np.random.randn(30, 30) # Create a heatmap with a sequential colormap plt.imshow(data, cmap='Blues') plt.colorbar() # Adds a color scale legend plt.title('Sequential Colormap Example') plt.show()
๐ŸŒ
Matplotlib
matplotlib.org โ€บ 3.1.0 โ€บ tutorials โ€บ colors โ€บ colormaps.html
Choosing Colormaps in Matplotlib โ€” Matplotlib 3.1.0 documentation
May 18, 2019 - Tutorials ยท Previous: Colormap Normalization ยท Next: Text in Matplotlib Plots ยท Show Page Source ยท Note ยท Click here to download the full example code ยท Matplotlib has a number of built-in colormaps accessible via matplotlib.cm.get_cmap. There are also external libraries like [palettable] and [colorcet] that have many extra colormaps.
๐ŸŒ
Matplotlib
matplotlib.org โ€บ 2.0.2 โ€บ examples โ€บ color โ€บ colormaps_reference.html
color example code: colormaps_reference.py โ€” Matplotlib 2.0.2 documentation
fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10) # Turn off *all* ticks & spines, not just the ones with colormaps. for ax in axes: ax.set_axis_off() for cmap_category, cmap_list in cmaps: plot_color_gradients(cmap_category, cmap_list, nrows) plt.show()
๐ŸŒ
GitHub
github.com โ€บ hhuangwx โ€บ cmaps
GitHub - hhuangwx/cmaps: user defined colormaps in matplotlib. ยท GitHub
import cmaps import numpy as np import inspect import matplotlib.pyplot as plt import matplotlib matplotlib.rc('text', usetex=False) def list_cmaps(): attributes = inspect.getmembers(cmaps, lambda _: not (inspect.isroutine(_))) colors = [_[0] for _ in attributes if not (_[0].startswith('__') and _[0].endswith('__'))] return colors if __name__ == '__main__': color = list_cmaps() a = np.outer(np.arange(0, 1, 0.001), np.ones(10)) plt.figure(figsize=(20, 20)) plt.subplots_adjust(top=0.95, bottom=0.05, left=0.01, right=0.99) ncmaps = len(color) nrows = 8 for i, k in enumerate(color): plt.subplot(nrows, ncmaps // nrows + 1, i + 1) plt.axis('off') plt.imshow(a, aspect='auto', cmap=getattr(cmaps, k), origin='lower') plt.title(k, rotation=90, fontsize=10) plt.title(k, fontsize=10) plt.savefig('colormaps.png', dpi=300) plt.close()
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ matplotlib โ€บ colormaps in matplotlib
Adding colormaps in matplotlib - Scaler Topics
November 9, 2022 - There are two ways of adding colormaps to our plots in matplotlib: using the get_cmap() function and the colors attribute of the ListedColorMap object.
๐ŸŒ
Purdue
docs.rcac.purdue.edu โ€บ workshops โ€บ matplotlib โ€บ colormaps
Colormaps - RCAC Documentation
April 9, 2026 - MatPlotLib has a great writeup ... as what each colormap looks like in greyscale. Using colormaps is quite simple: add the cmap='CMAP_NAME' option to the plotting function you are using and MatPlotLib will handle the rest....