matplotlib

Gists

Snippets

フォント

# フォントが未追加のときに追加する.
%matplotlib inline  
import matplotlib.pyplot as plt
from matplotlib import font_manager
if 'VL Gothic' not in font_manager.fontManager.ttflist:
    font_manager.fontManager.addfont('/usr/share/fonts/truetype/vlgothic/VL-Gothic-Regular.ttf')
plt.rcParams['font.family'] = 'VL Gothic'
plt.rcParams['font.size'] = 14

# 可搬性のために複数フォントを指定する.
%matplotlib inline  
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = [
    'Rounded Mplus 1c', 'Hiragino Maru Gothic Pro', 'IPAPGothic', 'Yu Gothic', 'Meiryo']

import matplotlib.colors as mcolors
# colors = mcolors.CSS4_COLORS
colors = mcolors.XKCD_COLORS
names = sorted(colors, key=lambda c: tuple(mcolors.rgb_to_hsv(mcolors.to_rgb(c))))