- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 plot a circle in Matplotlib?
To plot a circle in matplotlib, we can take the following steps −
Create a new figure or activate an existing figure using figure() method.
Add a subplot arrangement to the current axis.
Create a true circle at a center using Circle class.
Add a patch to the current axis.
Set limits of the x and y axes.
To display the figure, use show() method.
Example
from matplotlib import pyplot as plt, patches plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() ax = fig.add_subplot() circle1 = patches.Circle((0.2, 0.2), radius=0.5, color='green') ax.add_patch(circle1) ax.axis('equal') plt.show()
Output
- Related Articles
- How to plot a rectangle inside a circle in Matplotlib?
- Plot a circle inside a rectangle in Matplotlib
- Plot a circle with an edgecolor in Matplotlib
- How to plot a half-black and half-white circle using Matplotlib?
- Plot a circle with an edgecolor and hatch in Matplotlib
- How to a plot stem plot in Matplotlib Python?
- How to plot a watermark image in Matplotlib?
- How to animate a line plot in Matplotlib?
- How to remove lines in a Matplotlib plot?
- How to animate a scatter plot in Matplotlib?
- How to plot a 2D histogram in Matplotlib?
- How to make a rug plot in Matplotlib?
- How to plot a rainbow cricle in matplotlib?
- How to make a mosaic plot in Matplotlib?
- How to surface plot/3D plot from a dataframe (Matplotlib)?

Advertisements