- 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
Draw a parametrized curve using pyplot.plot() in Matplotlib
To draw a parametrized curve using pyplot.plot(), we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Initialize a variable, N, for number of samples.
- Create t, r, x and y data points using numpy.
- Create a figure and a set of subplots.
- Use plot() method to plot x and y data points.
- To display the figure, use show() method.
Example
import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 400 t = np.linspace(0, 2 * np.pi, N) r = 0.5 + np.cos(t) x, y = r * np.cos(t), r * np.sin(t) fig, ax = plt.subplots() ax.plot(x, y) plt.show()
Output
- Related Articles
- Draw parametrized curve using pyplot.plot() in Matplotlib
- How to fill the area under a step curve using pyplot? (Matplotlib)
- How to plot sine curve on polar axes using Matplotlib?
- How to curve text in a polar plot in matplotlib?
- How to draw a precision-recall curve with interpolation in Python Matplotlib?
- Draw a curve connecting two points instead of a straight line in matplotlib
- How to get an interactive plot of a pyplot when using PyCharm?
- How to draw axis lines inside a plot in Matplotlib?
- How to change the curve using radiobuttons in Matplotlib?
- Plot a bar using matplotlib using a dictionary
- Plot scatter points using plot method in Matplotlib
- How to zoom subplots together in Matplotlib/Pyplot?
- How to draw an average line for a scatter plot in MatPlotLib?
- How to animate a sine curve in Matplotlib?
- Filling the region between a curve and X-axis in Python using Matplotlib

Advertisements