Skip to content

Instantly share code, notes, and snippets.

@bryant1410
Created March 13, 2022 18:14
Show Gist options
  • Save bryant1410/baede8a5822e79b2f671ece6622f23bd to your computer and use it in GitHub Desktop.
Save bryant1410/baede8a5822e79b2f671ece6622f23bd to your computer and use it in GitHub Desktop.
LaTeX style for Matplotlib in Google Colab
# First: sudo apt install cm-super dvipng texlive-latex-extra texlive-latex-recommended texlive-science
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.rcParams["text.usetex"] = False # True # It looks better with the default font.
mpl.rcParams["text.latex.preamble"] = (r"\usepackage{siunitx}"
r" \sisetup{detect-all}"
r" \usepackage{helvet}"
r" \usepackage{sansmath}"
r" \sansmath")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment