- 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 does parameters 'c' and 'cmap' behave in a Matplotlib scatter plot?
To get a sense of how the parameters c and cmap behave in a Matplotlib scatterplot, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Initialize a variable N to store the number of sample data.
- Create x and y data points using numpy.
- Plot x and y data points using scatter() method, color and colormap.
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 50 x = np.random.randn(N) y = np.random.randn(N) plt.scatter(x, y, c=x, cmap="plasma") plt.show()
Output
- Related Articles
- How to animate a scatter plot in Matplotlib?
- Plot scatter points using plot method in Matplotlib
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- How to plot additional points on the top of a scatter plot in Matplotlib?
- How to make a discrete colorbar for a scatter plot in matplotlib?
- Connecting two points on a 3D scatter plot in Python and Matplotlib
- How can I make a scatter plot colored by density in Matplotlib?
- How to draw an average line for a scatter plot in MatPlotLib?
- Plot scatter points on polar axis in Matplotlib
- How to plot 4D scatter-plot with custom colours and cutom area size in Python Matplotlib?
- How to plot scatter masked points and add a line demarking masked regions in Matplotlib?
- How to plot scatter points in a 3D figure with a colorbar in Matplotlib?
- How to plot scatter points with increasing size of marker in Matplotlib?
- How to turn off transparency in Matplotlib's 3D Scatter plot?
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?

Advertisements