ex334.py
import numpy as np import matplotlib.pyplot as plt plt.axes(projection = 'polar') # creating an array # containing the angle values rads = np.arange(0,(2*np.pi),0.1) a=6 # plotting the cardioid for rad in rads: r = a*(1 + np.cos(rad)) plt.polar(rad,r,'ro',markersize=4) plt.savefig('ex334.png', dpi=72) plt.show()
Recent Comments