How to Plot ellipse in python

 How to plot ellipse in python 




There are two ways to do one is 

import numpy as np

import matplotlib.pyplot as plt

t = np.linspace(0,360,360)

x =10*np.cos(np.radians(t)) #10 is minor axis of ellipse

y = 50*np.sin(np.radians(t)) #50 is major axis of ellipse

plt.plot(x,y)

plt.show()



i prefer this one because i have mechanical engineering background


from numpy import *
from matplotlib.pyplot import *
t = linspace(0,360,360)
x = 10*cos(radians(t)) #10 is minor axis of ellipse
y = 50*sin(radians(t))#50 is major axis of ellipse
plot(x,y)
show()

output will be same for both


How to plot a circle in Python

Post a Comment

0 Comments