Colaboratoryでグラフの日本語表示

インストール

!apt install fonts-ipafont-gothic
!rm /root/.cache/matplotlib/fontList.json

使用時

import pandas as pd
import matplotlib.pyplot as plt

plt.rcParams['font.family'] = 'IPAPGothic'

# seaborn利用時
import seaborn as sns

sns.set(font=['IPAPGothic'], font_scale=1.2, style='whitegrid',rc= {'legend.frameon': True})
名前 背景 グリッド
darkgrid グレー あり
dark グレー なし
whitegrid ホワイト あり
white ホワイト なし
ticks ホワイト 軸にのみ