LoginSignup
1
2

More than 3 years have passed since last update.

python/matplotlibで円を描く

Posted at

意外と簡単で、sinとcosを対応させてあげるだけ。

circle.png

circle.py
import matplotlib.pyplot as plt
import math
import numpy as np

x,y=[],[]

for _x in np.linspace(-180,180,360):
    x.append(math.sin(math.radians(_x)))
    y.append(math.cos(math.radians(_x)))

plt.plot(x,y)

plt.title('circle')
plt.xlabel('sinx')
plt.ylabel('cosx')

plt.axes().set_aspect('equal','datalim') # 楕円に見えてしまうため縦横比を調整

plt.show() 
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2