- 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 shade points in a scatter based on colormap in Matplotlib?
To shade points in a scatter based on colormap, we can use copper colormap in scatter() method.
Steps
Set the figure size and adjust the padding between and around the subplots.
Create x and y random 100 data points using numpy.
Plot scatter points x and y with color=x and colormap=copper.
To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt, cm plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.random.rand(100) y = np.random.rand(100) plt.scatter(x, y, c=x, cmap='copper') plt.show()
Output
- Related Articles
- Plot scatter points on polar axis in Matplotlib
- How to plot additional points on the top of a scatter plot in Matplotlib?
- How to annotate the points on a scatter plot with automatically placed arrows in Matplotlib?
- Plot a polar color wheel based on a colormap using Python/Matplotlib
- Connecting two points on a 3D scatter plot in Python and Matplotlib
- How to plot scatter points in a 3D figure with a colorbar in Matplotlib?
- Plot scatter points on a 3D projection with varying marker size in Matplotlib
- How to set a default colormap in Matplotlib?
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- How to extract a subset of a colormap as a new colormap in Matplotlib?
- Plotting scatter points with clover symbols in Matplotlib
- Plot scatter points using plot method in Matplotlib
- How to plot scatter points with increasing size of marker in Matplotlib?
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?
- Adding a scatter of points to a boxplot using Matplotlib

Advertisements