Use the package manager pip to install SacredFig.
pip install sacredfig
Simply import the package and use the sacredfig style:
import matplotlib.pyplot as plt
import sacredfig
plt.style.use(sacredfig.style)
fig, ax = plt.subplots(figsize=(4, 4), dpi=150)
ax.grid(False, which='major', axis='x')
ax.plot([0, 1], [0, 1])
ax.set_box_aspect(1)
ax.set(xlabel="x", ylabel="y")
You can also use sacredfig temporarily:
with plt.style.context(sacredfig.style):
ax.plot(np.sin(np.linspace(0, 2 * np.pi)), 'r-o')