Home > front end >  How to plot circles with numpy and matplotlib
How to plot circles with numpy and matplotlib

Time:04-16

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()

CodePudding user response:

You may change line4 to

theta=np.linspace(0,2*np.pi)
  • Related