[PYTHON] Set matplotlib font on ubuntu

Check Font on Ubuntu

https://wiki.ubuntulinux.jp/UbuntuTips/Desktop/InstallFont#A.2BYktS1TBnMKQw8zC5MMgw.2FDDrMFkwiw-

List fonts

fc-list|less

Check if there is a font you want to use

Example: Whether there is a font containing Takao

fc-list|less | grep Takao

Download the fonts you need

https://github.com/blagarde/midori/blob/master/fonts-japanese-gothic.ttf https://github.com/marcan/blitzloop/blob/master/TakaoPGothic.ttf <-Since this is gone, I tried the following (2017/10/07)

https://github.com/byrongibson/fonts/blob/master/backup/truetype.original/takao-gothic/TakaoPGothic.ttf

Download these two this time

Place the downloaded font

Copy the following to / usr / local / share / fonts / on the directory where the above two are placed

cp *ttf /usr/local/share/fonts/

Set font in matplotlib config file

Check the location of the configuration file below

>>> import matplotlib
>>> matplotlib.matplotlib_fname()
'/home/foo/.config/matplotlib/matplotlibrc'

Just write the following in ~ / .config / matplotlib / matplotlibrc,

font.family: (The font you want to use)

This time,

font.family: TakaoPGothic

And said.

Delete Matplotlib Font cache

Lastly, the important thing that was the article of Drawing Japanese with matplotlib on Ubuntu!

Delete Font cache

rm ~/.cache/matplotlib/fontList.cache

The file name may be different, so find the file with fontList under ~ / .cache / matplotlib / and delete it.

Recommended Posts

Set matplotlib font on ubuntu
Set up Python 3.4 on Ubuntu
Use matplotlib on Ubuntu 12 & Python
Draw Japanese with matplotlib on Ubuntu
Shebang on Ubuntu 20.04
Set swap space on Ubuntu on Raspberry Pi
On Ubuntu Linux, set Tab to q
[Python] Japanese localization of matplotlib on Ubuntu
Install TensorFlow on Ubuntu
Set sitecustomize.py on CircleCI.
Install PySide2 on Ubuntu
Install JModelica on Ubuntu
build Python on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Installing pyenv on ubuntu 16.04
Install Theano on Ubuntu 12.04
Install angr on Ubuntu 18.04
Install pip / pip3 on Ubuntu
Set up python and machine learning libraries on Ubuntu
I installed tensorRT on Ubuntu 18.04
Run Jupyter on Ubuntu on Windows
SoftwareRAID 0 on SereneLinux (Ubuntu 18.04 Desktop)
I installed ROS on Ubuntu 18.04
Put Python 3.x on Ubuntu
Rebuild kernel on Ubuntu 20.04 (on Azure)
Operate ubuntu on VScode (windows10)
Create command shortcuts on Ubuntu 16.04
Install GoLand IDE on Ubuntu
Display GUI messages on Ubuntu
Install OpenCV on Ubuntu + python
wsl Install PostgreSQL on Ubuntu 18.04
Set up Polyglot on Windows
Introducing TensorFlow on Ubuntu + Python 2.7
[ROS] Install ROS (melodic) on Ubuntu (18.04)
Install Caffe on Ubuntu 14.04 (GPU)
Install Docker on WSL Ubuntu 18.04
View matplotlib plots on Tensorboard
Install CUDA10.1 + cuDNN7.6.5 + tensorflow-2.3.0 on Ubuntu 18.04
Remove ubuntu installed on Windows 10 machine
Python 3.4 pyvenv fails on Ubuntu 14.04 LTS
Changed partition mount point on Ubuntu
Install Caffe on Ubuntu 14.04 (CPU mode)
Prepare Python development environment on Ubuntu
[Python] font family and font with matplotlib
matplotlib: Insert comment on timeline graph
Install Mecab and mecab-python3 on Ubuntu 14.04
Install and run dropbox on Ubuntu 20.04
Install OpenCV and Chainer on Ubuntu
Install CUDA 8.0 and Chainer on Ubuntu 16.04
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Steps to install matplotlib on Mac
Introducing Python using pyenv on Ubuntu 20.04
Preparing python using vscode on ubuntu
Mount S3 on Ubuntu with goofys
How to run matplotlib on heroku
Run Matplotlib on a Docker container
Set up Python environment on CentOS
I tried Cython on Ubuntu on VirtualBox
Paste the matplotlib figure on excel
Install fabric on Ubuntu and try
Using a serial console on Ubuntu 20.04