'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 1:[1]
You may change line4 to
theta=np.linspace(0,2*np.pi)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | finko |
