- 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 to draw a filled arc in Matplotlib?
To draw a filled arc in matplotlib, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Create a figure and a set of subplots.
Initialize two variables, r, yoff.
Create x and y data points using Numpy.
Fill the area between x and y plots.
Set the axis aspect and draw the figure canvas.
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 fg, ax = plt.subplots(1, 1) r = 2. yoff = -1 x = np.arange(-1., 1.05, 0.05) y = np.sqrt(r - x ** 2) + yoff ax.fill_between(x, y, 0) ax.axis([-2, 2, -2, 2]) ax.set_aspect("equal") fg.canvas.draw() plt.show()
Output
- Related Articles
- How to draw a circle with arc() in HTML5?
- How to draw an arc on a tkinter canvas?
- How to draw a filled circle in OpenCV using Java?
- How to draw a filled ellipse in OpenCV using Java?
- How to draw a filled polygon in OpenCV using Java?
- How to draw filled ellipses in OpenCV using Python?
- How to draw a filled polygon using an imagefilledpolygon() function in PHP?
- How to draw a partial arc and fill it using imagefilledarc() function in PHP?
- How to draw axis lines inside a plot in Matplotlib?
- How to draw node colormap in NetworkX/Matplotlib?
- How to draw a line outside of an axis in Matplotlib?
- How to draw axis in the middle of a figure in Matplotlib?
- How to draw more type of lines in Matplotlib?
- How to draw a rectangle over a specific region in a Matplotlib graph?
- Draw a filled polygon using the OpenCV function fillPoly()

Advertisements