Jul-10-2020, 03:16 PM
Hi,
I do simply have a plot but I need to show only a specific part of that plot. When I run the code below, it shows all possible results but I need only the part between y=-3 and y=3 also x=-3 and x=3.
If you can help me I will be very appreciated.
I do simply have a plot but I need to show only a specific part of that plot. When I run the code below, it shows all possible results but I need only the part between y=-3 and y=3 also x=-3 and x=3.
If you can help me I will be very appreciated.
import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
def f(t,r):
theta,x,z=r
ftheta=(-1/2)*(np.cos(x)*np.cos(z)+np.sin(theta)/100)
fx=0.5*np.sin(theta)-(1/2)*np.cos(x)*np.sin(z)
fz=0.5*np.cos(theta)+(1/2)*np.sin(x)*np.cos(z)
return ftheta,fx, fz
sol=integrate.solve_ivp(f,(0,2000),(np.pi/4,-np.pi/2,-np.pi/2), t_eval=np.linspace(0,2000,100000))
theta,x,z=sol.y
#plotting
plt.plot(x,z,color="red")
plt.show()
