Python ProgrammingPython Programming

Plot half polar graph in Matplotlib

Plot half polar graph:

import matplotlib.pyplot as plt
import numpy as np

theta = np.linspace(0, np.pi)
r = np.sin(theta)

fig = plt.figure()
ax = fig.add_subplot(111, polar=True)
c = ax.scatter(theta, r, c=r, s=10, cmap='hsv', alpha=0.75)

ax.set_thetamin(0)
ax.set_thetamax(180)

plt.show()

The following is the output that will be obtained:


Plot half polar graph in Matplotlib