import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
rcParams['font.size'] = 16
rcParams['font.family'] = 'serif'
# Colors
red = '#e41a1c'
blue = '#377eb8'
green = '#4daf4a'
purple = '#984ea3'
# Data
sigma = 5.670373e-8
area = 1
emissivity = 1
T = np.linspace(0, 400)
P = lambda T: sigma * area * emissivity * T**4
# First plot
fig = plt.figure(figsize=(8, 5))
ax1 = fig.add_subplot(111)
plt.plot(T, P(T), lw=2, color='black')
plt.grid(b=True, ls='--', alpha=0.4)
plt.xlabel(r"$T$ (K)")
plt.ylabel(r"$P$ (W/m$^2$)")
# Annotations
plt.plot(273.15, P(273.15), 'o', color=blue, ms=10)
plt.text(240, P(273.15), 'Ice', color=blue, va='center')
plt.plot(293.15, P(293.15), 'o', color=green, ms=10)
plt.text(300, P(293.15), 'Room\ntemperature', color=green, va='top')
plt.plot(310.15, P(310.15), 'o', color=purple, ms=10)
plt.text(220, P(310.15) + 10, 'Body\ntemperature', color=purple, va='bottom')
plt.plot(373.15, P(373.15), 'o', color=red, ms=10)
plt.text(320, P(373.15), 'Boiling\nwater', color=red)
# Second axis
ax2 = ax1.twiny()
ax2.set_xlim([-273.15, 126.85])
plt.xlabel(r"$T$ ($^\circ$C)")
plt.savefig('Emissive_Power.svg', bbox_inches='tight')
plt.show()