2023-05-11

MatplotLib & Seaborn

Table of Contents

1. Excellent Notes on Typesetting Figures for Papers

1.1. Find fonts used in latex

Search for commands like:

\renewcommand{\rmdefault}{ppl}
\renewcommand{\sfdefault}{phv}
\renewcommand{\ttdefault}{pcr}
  • rmdefault is the default roman font
  • sfdefault => sans serif font
  • ttdefault => typewriter style

Short form of th fonts

Name Font
bch Charter
lmr Latin Modern Roman
lmss Latin Modern Sans Serif
lmssq Latin Modern Sans Serif extended
lmtt Latin Modern Typewriter
lmvtt Latin Modern Typewriter proportional
pag Avant Garde
pbk Bookman
pcr Courier
phv Helvetica
pnc New Century Schoolbook
ppl Palatino
ptm Times
put Utopia
pzc Zapf Chancery

(From https://www.xoolive.org/2008/04/03/fonts-in-latex.html)

2. After adding a font to system, delete cache

rm -r ~/.matplotlib

Font location can be found by

import matplotlib
return matplotlib.get_cachedir()
/Users/bpanthi977/.matplotlib

You can send your feedback, queries here