plot_sin_polar 2¶

Query¶

import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

"""
Create matrix of ones
"""
a = np.ones((5,10))
# end

# plot a sin wave in polar coordinates from 0 to 4 pi

Output¶

import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

"""
Create matrix of ones
"""
a = np.ones((5,10))
# end

# plot a sin wave in polar coordinates from 0 to 4 pi
theta = np.linspace(0, 4*np.pi, 100)
r = np.sin(theta)
ax = plt.subplot(111, projection='polar')
ax.plot(theta, r)
ax.set_rmax(1.0)
ax.set_rticks([0.5, 1])  # less radial ticks
ax.set_rlabel_position(-22.5)  # get radial labels away from plotted line
ax.grid(True)

ax.set_title("A line plot on a polar axis", va='bottom')
plt.savefig('polar.png')

Evaluate¶

Go to Google Form