- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to make the Parula colormap in Matplotlib?
To make the Parula colormap in matplotlib, we can take the following steps
- Set the figure size and adjust the padding between and around the subplots.
- Create colormap data using numpy.
- Create a 'LinearSegmentedColormap' from a list of colors.
- Viscum is a little tool for analyzing colormaps and creating new colormaps.
- Use imshow() method to display data as an image, i.e., on a 2D regular raster.
- To display the figure, use show() method.
Example
from matplotlib.colors import LinearSegmentedColormap import matplotlib.pyplot as plt import numpy as np from viscm import viscm plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True cm_data = np.random.rand(4, 4) parula_map = LinearSegmentedColormap.from_list('parula', cm_data) viscm(parula_map) plt.imshow(np.linspace(0, 100, 256)[None, :], aspect='auto', cmap=parula_map) plt.show()
Output
- Related Articles
- How to set a default colormap in Matplotlib?
- How to draw node colormap in NetworkX/Matplotlib?
- How to display the matrix value and colormap in Matplotlib?
- How to extract a subset of a colormap as a new colormap in Matplotlib?
- How to increase colormap/linewidth quality in streamplot Matplotlib?
- Extract Matplotlib colormap in hex-format
- Defining the midpoint of a colormap in Matplotlib
- How to plot data into imshow() with custom colormap in Matplotlib?
- Add alpha to an existing Matplotlib colormap
- How to shade points in a scatter based on colormap in Matplotlib?
- How to create a matplotlib colormap that treats one value specially?
- How to redefine a color for a specific value in a Matplotlib colormap?
- Defining a discrete colormap for imshow in Matplotlib
- Set a colormap of an image in Matplotlib
- Set two Matplotlib imshow plots to have the same colormap scale

Advertisements