Skip to content

Instantly share code, notes, and snippets.

@ISDementyev
Last active March 29, 2023 11:41
Show Gist options
  • Save ISDementyev/d8f2e8cf4d198dbb734775cd6a829c9d to your computer and use it in GitHub Desktop.
Save ISDementyev/d8f2e8cf4d198dbb734775cd6a829c9d to your computer and use it in GitHub Desktop.
Matplotlib plot with LaTeX (Computer Modern) font
import matplotlib.pyplot as plt
plt.style.use('seaborn') # I personally prefer seaborn for the graph style, but you may choose whichever you want.
params = {"ytick.color" : "black",
"xtick.color" : "black",
"axes.labelcolor" : "black",
"axes.edgecolor" : "black",
"text.usetex" : True,
"font.family" : "serif",
"font.serif" : ["Computer Modern Serif"]}
plt.rcParams.update(params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment