cgjosephlee / mpl_no_tofu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No Tofu

Eat all the tofus in your matplotlib plot!

Download and install Noto fonts to matplotlib library without modifying system fonts. Supports Chinese, Japanese, Korean, and any font in Google fonts repo. This is useful when using Google Colab and Sagemaker Studio/Notebooks.

Demo notebook.

Quick guide

Installation

pip install git+https://github.com/cgjosephlee/mpl_no_tofu.git

Load fonts

import matplotlib.pyplot as plt
from mpl_no_tofu import load_fonts
load_fonts("NotoSansTC")
# your plots

Available fonts

  • NotoSansTC
  • NotoSerifTC
  • NotoSansSC
  • NotoSerifSC
  • NotoSansHK
  • NotoSansJP
  • NotoSerifJP
  • NotoSansKR
  • NotoSerifKR

Install fonts via google fonts METADATA.pb file

Find your font in Google fonts repo and copy the path of METADATA.pb.

load_fonts("https://github.com/google/fonts/raw/main/ofl/notosansthailooped/METADATA.pb")

Similar projects

About

License:MIT License


Languages

Language:Jupyter Notebook 77.8%Language:PureBasic 18.9%Language:Python 3.3%