- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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.
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()
- 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 a filled polygon using an imagefilledpolygon() function in PHP?
- Draw a filled polygon using the OpenCV function fillPoly()
- How to draw a partial arc and fill it using imagefilledarc() function in PHP?
- Draw a circle filled with random color squares on HTML5 canvas
- How to draw axis lines inside a plot in Matplotlib?
- How to draw node colormap in NetworkX/Matplotlib?
- Draw a border around subplots in Matplotlib
- How to draw a line outside of an axis in Matplotlib?
- How to draw rounded line ends using Matplotlib?
- How to draw more type of lines in Matplotlib?