Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to plot circles with numpy and matplotlib

I’m trying to graph 3 circles with different radii but with my code there is nothing being printed. Could someone tell me what I’m doing wrong? I am supposed to use numpy and matplotlib.

import numpy as np
import matplotlib.pyplot as plt

theta=np.arange(0,2*np.pi,360)
plt.plot(0.25*np.cos(theta),0.25*np.sin(theta),"g")
plt.axis("equal")
plt.plot(1*np.cos(theta),1*np.sin(theta),"--b")
plt.plot(2*np.cos(theta),2*np.sin(theta),"--r")
plt.show()

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You may change line4 to

theta=np.linspace(0,2*np.pi)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading