plot_sin_polar 1¶

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)

plt.figure()
plt.polar(theta, r)
plt.savefig('polar.png')

# plot a sin wave in cartesian coordinates from 0 to 4 pi
theta = np.linspace(0, 4*np.pi, 100)
r = np.sin(theta)

plt.figure()
plt.plot(theta, r)
plt.savefig('cartesian.png')

Evaluate¶

Go to Google Form