# Plot Polar Chart in Python using matplotlib

In this tutorial, we will learn how to plot polar charts in Python.

Matplotlib library in Python is a plotting library and it has a further extension in numerical mathematics known as NumPy. It is used for embedding plots into applications. It makes use of Tkinter etc. GUI tools for the embedding of plots into applications.

## Polar Chart plotting using matplotlib

A **polar chart** represents data radially and on angular axes as a graph.

A point in polar is represented as `(r, Θ)`

.

The ‘`pyplot`

‘ module includes a function polar that is used for drawing a polar plot.

*Plot a Circle: polar form*

import numpy as np import matplotlib.pyplot as plot plot.axes(projection='polar') # title of the plot plot.title('Circle in polar format:r=R') # Plot a circle r = np.arange(0, (2*np.pi), 0.01) for radian in r: plot.polar(radian,2,'o') plot.show()

*Output:*

*Example2- Employees:*

import matplotlib.pyplot as plt import numpy as np employee = ["Hermoine", "Ron", "Harry", "James", "Lily"] a = [10, 12, 15, 20, 30, 35] e = [15, 15, 20, 20, 30, 40] plt.figure(figsize=(10, 6)) plt.subplot(polar=True) theta = np.linspace(0, 2 * np.pi, len(actual)) lines, labels = plt.thetagrids(range(0, 360, int(360/len(employee))), (employee)) # Plot actual sales graph plt.plot(theta, a) plt.fill(theta, a, 'b', alpha=0.1) # Plot expected sales graph plt.plot(theta, e) # Add legend and title for the plot plt.legend(labels=('Actual', 'Expected'), loc=1) plt.title("Actual vs Expected sales") # Dsiplay the plot on the screen plt.show()

*Output:*

## Leave a Reply