- 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
Showing points coordinate in a plot in Python Matplotlib
To show points coordinate in a plot in Python, we can take the following steps −
Steps
Set the figure size and adjust the padding between and around the subplots.
Initilize a variable N and create x and y data points using numpy.
Zip the x and y data points; iterate them and place coordinates.
To display the figure, use show() method.
Example
import matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 5 x = np.random.rand(N) y = np.random.rand(N) plt.plot(x, y, 'r*') for xy in zip(x, y): plt.annotate('(%.2f, %.2f)' % xy, xy=xy) plt.show()
Output
It will produce the following output −
- Related Articles
- Showing points coordinates in a plot in Python using Matplotlib
- Getting empty tick labels before showing a plot in Matplotlib
- Plot scatter points using plot method in Matplotlib
- Connecting two points on a 3D scatter plot in Python and Matplotlib
- How to plot blurred points in Matplotlib?
- Annotating points from a Pandas Dataframe in Matplotlib plot
- How to a plot stem plot in Matplotlib Python?
- Plot scatter points on polar axis in Matplotlib
- Shading an area between two points in a Matplotlib plot
- How to plot additional points on the top of a scatter plot in Matplotlib?
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- How to plot scatter points in a 3D figure with a colorbar in Matplotlib?
- How I can get a Cartesian coordinate system in Matplotlib?
- How to plot a layered image in Matplotlib in Python?
- How to plot a phase spectrum in Matplotlib in Python?

Advertisements