
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How can I plot a single point in Matplotlib Python?
To plot a single data point in matplotlib, we can take the following steps −
Initialize a list for x and y with a single value.
Limit X and Y axis range for 0 to 5.
Lay out a grid in the current line style.
Plot x and y using plot() method with marker="o", markeredgecolor="red", markerfacecolor="green".
To display the figure, use show() method.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = [4] y = [3] plt.xlim(0, 5) plt.ylim(0, 5) plt.grid() plt.plot(x, y, marker="o", markersize=20, markeredgecolor="red", markerfacecolor="green") plt.show()
Output
- Related Articles
- How to plot one single data point in Matplotlib?
- How can I plot a confusion matrix in matplotlib?
- How can I plot hysteresis threshold in Matplotlib?
- How can matplotlib be used to plot 3 different datasets on a single graph in Python?
- How can I place a table on a plot in Matplotlib?
- How can I plot two different spaced time series on one same plot in Python Matplotlib?
- How do I plot a step function with Matplotlib in Python?
- How can I make a scatter plot colored by density in Matplotlib?
- How to plot pie-chart with a single pie highlighted with Python Matplotlib?
- How to a plot stem plot in Matplotlib Python?
- How to plot a point on 3D axes in Matplotlib?
- Explain how a quiver plot can be built using Matplotlib Python?
- Can I give a border to a line in Matplotlib plot function?
- How can I plot NaN values as a special color with imshow in Matplotlib?
- How do I plot only a table in Matplotlib?

Advertisements