Skip to content

Instantly share code, notes, and snippets.

@paidi
Last active September 7, 2023 08:59
Show Gist options
  • Save paidi/ea669037b68fd8ad2da25086b3d9d296 to your computer and use it in GitHub Desktop.
Save paidi/ea669037b68fd8ad2da25086b3d9d296 to your computer and use it in GitHub Desktop.
Loading DM Sans in matplotib
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
# Fetch DM Sans font file from https://github.com/google/fonts/blob/main/ofl/dmsans/DMSans%5Bopsz%2Cwght%5D.ttf
font_dir = ['.']
for font in fm.findSystemFonts(font_dir):
fm.fontManager.addfont(font)
# Set font family globally
plt.rcParams['font.family'] = 'DM Sans'
sns.set_theme(font_scale=1.5, style="whitegrid")
biomodal_palette = ["#9CDBD9", "#C0DF16","#003B49","#05868E", "#ABAD9A", "#F87C56","#00DAEF","#50B37B"]
sns.set_palette(biomodal_palette)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment