I want to plot on the same graph one function (data coming from an array) and the line between (xmin,ymin) to (xmax,ymax) of data
import numpy as np
import matplotlib.pyplot as plt
exo_data = np.loadtxt('./exoplanets.dat')
au2m = 149597870700
day2seconds = 86400
M_Jupiter = 1.898e27
M_Sun = 1.989e30
G = 6.674e11
R=exo_data[:,0]*au2m
T=exo_data[:,1]*day2seconds
Mp=exo_data[:,2]*M_Jupiter
Ms=exo_data[:,3]*M_Sun
Mstar=np.mean(Ms)
C=(mth.pi*4)/G*Mstar
x=R**3
y=T**2
xmin=np.min(R)
ymin=np.min(T)
xmax=np.max(R)
ymax=np.max(T)
plt.plot([xmin,ymin], [xmax,ymax], color='red')
plt.plot(x,y, 'ro', color='blue')
plt.show
plt.close
I have only the first plot in spyder console, not the second one