A polar chart is used to display multivariate data and is also known as a radar chart or a spider chart. It is often seen in illustrations of strength in different aspects of different objects for comparison, such as the evaluation of the price and various specifications of a piece of hardware, or the abilities of a game character.
Moreover, polar plots are also useful in drawing mathematical functions, which we are going to demonstrate here. In Matplotlib, we draw polar charts with the command plt.polar(). Apart from the x, y coordinate system we are familiar with, polar coordinates are used for polar charts, angles, and radii. The central point is called the pole. Note that Matplotlib takes a degree unit for the angle input.
Here is the code to draw a polar rose:
import numpy as np
import matplotlib.pyplot as plt
theta = np.arange(0., 2., 1./180.)*np.pi
plt.polar(3*theta, theta/6)
plt.polar(theta, np.cos(6*theta))
plt.polar(theta, [1.2]*len(theta))
plt.savefig('mpldev_03_polarrose.png')
plt.show()
This is the result. How many petals do you see in the rose?
We can also make use of the polar coordinate system to create charts such as a heatmap of wind speed of the earth in geography, or the surface temperature of a round object for engineers. We will leave these advanced uses for you as an exercise when you have completed this book.