I want to generate a line graph of temperature versus power and have written the following code:
import numpy as np
import matplotlib.pyplot as plt
temps = np.arange(288, 314, 1)
sigma = 5.67e-8 #Stefan's constant, units = W m^-2 K^-4
T0 = 298 #ambient T, 25 degrees
emissivity = 0.96
A = (np.pi * 309)/80000 #total surface area of chameleon
def SB(T):
power = A * sigma * emissivity * (T**4 - T0**4)
return power
power = SB(temps)
plt.plot(temps, power)
plt.xlabel("Temperature (K)")
plt.ylabel("Power (W $m^{-2}$)")
plt.title("Net Power Radiated vs T")
plt.xlim(288, 314)
plt.ylim(0, 1.2)
plt.show()
The axes are showing but I'm not getting a line, could it be because the function doesn't take values from np.arange? If so how would I fix this? Any help would be appreciated! :D
Rachel