# Generated by pandoc-plot 1.8.0
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(2019)


CENTER1 = 4.0
CENTER2 = CENTER1 * 1/4

electrons = np.random.normal(loc=CENTER1, scale=0.2, size=3000)
lattice = np.random.normal(loc=CENTER2, scale=0.5, size=2500)

fig, ax = plt.subplots(1,1, figsize=(8,3))

ax.axvline(x=CENTER1, color='k')
ax.axvline(x=CENTER2, color='k')

electrons_hist, *_ = ax.hist(electrons, bins=50, color='b', label='electrons')
lattice_hist, *_ = ax.hist(lattice, bins=50, color='r', label='nuclei')

textheight = min([electrons_hist.max(), lattice_hist.max()])/4

ax.text(x=1.02*CENTER1, y=textheight, s="$T_e$")
ax.text(x=1.02*CENTER2, y=textheight, s="$T_l$")

ax.set_xlabel('Particle kinetic energy')
ax.set_ylabel('Number of particles')
ax.set_yticks([])
ax.set_xticks([])
plt.legend()
Click here to see how this plot was generated.