Skip to content
Echedey Luis edited this page Mar 18, 2023 · 9 revisions

Installing Latex

Installing CJK fonts


CJK font styles have been deprecated in favour of other packages that maintain it actively. For example, make use mplfonts See issue#84.

Till we get some more info, we will preserve this wiki section.

  • To use Chinese, Japanese or Korean fonts, you first need to install Noto CJK Fonts. You can download and install these fonts from the given link or you can install them with a package manager:

    # Ubuntu / Debian
    sudo apt update
    sudo apt install fonts-noto-cjk
    # macOS
    brew tap homebrew/cask-fonts
    brew cask install font-noto-serif-cjk-tc
    brew cask install font-noto-serif-cjk-sc
    brew cask install font-noto-serif-cjk-jp
    brew cask install font-noto-serif-cjk-kr
    # archlinux
    sudo pacman -S noto-fonts-cjk
  • For Windows Subsystem for Linux (WSL), you will need to manually download and install the fonts by following these instructions.

  • Note that matplotlib may not find the fonts correctly. You can refresh the font cache by running:

    Warning: this was deprecated in matplotlib 3.4.0, see issue#84

    import matplotlib.font_manager as fm
  • See this issue for more information.

Installing SciencePlots manually

  • If you like, you can install the *.mplstyle files manually. First, clone the repository and then copy all of the *.mplstyle files into your Matplotlib style directory. If you're not sure where this is, in an interactive python console type:

    import matplotlib
    import scienceplots
  • You should get back something like /home/garrett/.matplotlib. You would then put the *.mplstyle files in /home/garrett/.matplotlib/stylelib/ (you may need to create the stylelib directory):

    cp styles/*.mplstyle ~/.matplotlib/stylelib/ && cp styles/*/*.mplstyle ~/.matplotlib/stylelib/

Using different fonts

  • SciencePlots uses the default serif font. If you would like to specify a different font, you can use:

    import matplotlib.pyplot as plt
    import scienceplots'science')
        "": "serif",   # specify font family here
        "font.serif": ["Times"],  # specify font here
        "font.size":11})          # specify font size here
  • If you would like to use Times New Roman specifically, please see the discussion in this issue.

Installing SciencePlots within Google Colab, IPython, Jupyter Notebooks, etc.

After version 2.0.0, using SciencePlots is the same as explained above.

Prior to version 2.0.0, you may have had to reload the Matplotlib style library.

    !pip install SciencePlots
    import matplotlib.pyplot as plt
    import scienceplots'science')