A point in polar co-ordinates is represented as (r, theta). Here, r is its distance from the origin and theta is the angle at which r has to be measured from origin. Any mathematical function in the Cartesian coordinate system can also be plotted using the polar coordinates.
- Matplotlib : Matplotlib is a comprehensive Python library for creating static and interactive plots and visualisations. To install this module type the below command in the terminal.
pip install matplotlib
- Numpy : Numpy is the core library for array computing in Python. To install this module type the below command in the terminal.
pip install numpy
- math : math is a built-in module used for performing various mathematical tasks.
The matplotlib.pyplot module contains a function polar(), which can be used for plotting curves in polar coordinates.
Syntax : matplotlib.pyplot.polar(theta, r, **kwargs)
- theta – angle
- r – distance
In each of the examples below,
- A list of radian values is created. These values cover the domain of the respective function.
- For each radian value, theta, a corresponding value of r is calculated according to a specific formula for each curve.
1. Circle : A circle is a shape consisting of all points in a plane that are a given distance(radius) from a given point, the centre. Hence, r is a constant value equal to the radius.
2. Ellipse : An ellipse is the locus of a point moving in a plane such that the sum of its distances from two other points (the foci) is constant. Here, r is defined as :
- a = length of semi major axis
- b = length of semi minor axis
3. Cardioid : A cardioid is the locus of a point on the circumference of a circle as it rolls around another identical circle. Here, r is defined as :
Where, a = length of axis of cardioid
4. Archimedean spiral : An Archimedean spiral is the locus of a point moving uniformly on a straight line, which itself is turning uniformly about one of its end points. Here, r is defined as :
5. Rhodonea : A Rhodonea or Rose curve is a rose-shaped sinusoid plotted in polar coordinates. Here, r is defined as :
- a = length of petals
- n = number of petals
- Python Bokeh - Plotting Quadratic Curves on a Graph
- matplotlib.pyplot.polar() in Python
- Python - cmath.polar() function
- How to plot Andrews curves using Pandas in Python?
- Rhodonea Curves and Maurer Rose in Python
- Make filled polygons between two curves in Python using Matplotlib
- Make filled polygons between two horizontal curves in Python using Matplotlib
- Graph Plotting in Python | Set 1
- Graph Plotting in Python | Set 3
- Graph Plotting in Python | Set 2
- Add QT GUI to Python for plotting graphics
- Calibration Curves
- Using Learning Curves - ML
- 3D Surface plotting in Python using Matplotlib
- Python | Geographical plotting using plotly
- Python Bokeh – Plotting Ys on a Graph
- Plotting graph using Seaborn | Python
- Plotting World Map Using Pygal in Python
- Three-dimensional Plotting in Python using Matplotlib
- Plotting Histogram in Python using Matplotlib
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.