- 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
Plot scatter points using plot method in Matplotlib
To plot scatter points using plot method in matplotlib, we can take the following steps−
- Create random data points (x1 and x2) using numpy.
- Plot x1 data points using plot() method with marker size 20 and green color.
- Plot x2 data points using plot() method with marker size 10 and red color.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x1 = np.random.randn(20) x2 = np.random.randn(20) plt.plot(x1, 'go', markersize=20) plt.plot(x2, 'ro', ms=10) plt.show()
Output
- Related Articles
- Plot scatter points on polar axis 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 plot scatter points with increasing size of marker in Matplotlib?
- Connecting two points on a 3D scatter plot in Python and Matplotlib
- Plot scatter points on a 3D projection with varying marker size in Matplotlib
- How to animate a scatter plot in Matplotlib?
- How to plot scatter points in a 3D figure with a colorbar in Matplotlib?
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?
- Adding caption below X-axis for a scatter plot using Matplotlib
- How to plot scatter masked points and add a line demarking masked regions in Matplotlib?
- How to annotate the points on a scatter plot with automatically placed arrows in Matplotlib?
- Showing points coordinates in a plot in Python using Matplotlib
- Adding a line to a scatter plot using Python's Matplotlib
- How to plot blurred points in Matplotlib?

Advertisements