LoginSignup
2
0

More than 3 years have passed since last update.

論文用holoviewsの設定

Last updated at Posted at 2020-11-30

matplotlibのラッパーであるholoviewsの論文用の設定メモ

matplotlibの設定は https://qiita.com/MENDY/items/fe9b0c50383d8b2fd919 を参考にした。

import numpy as np
import holoviews as hv
hv.extension('matplotlib') 

from matplotlib import rcParams
rcParams['font.family'] = 'Times New Roman' # font familyの設定
rcParams['mathtext.fontset'] = 'stix' # math fontの設定
rcParams["font.size"] = 24 # 全体のフォントサイズが変更されます。
rcParams['xtick.labelsize'] = 24 # 軸だけ変更されます。
rcParams['ytick.labelsize'] = 24 # 軸だけ変更されます

options_dict = {
    'Curve':
    {
        'fig_size':200,
        'fontsize': 15,
        # 'fontsize': {'labels': 24, 'legend': 18}, 細かく指定もできる
        'show_frame': True,
        #'show_grid':True,
        'xlabel': r'Using Tex $\alpha$', # 今回は非表示にしている
        'ylabel': 'Cross-Entropy loss',
    },
}


x = np.linspace(-np.pi, np.pi, 100)
y = np.sin(x)
img = (hv.Curve((x, y), label='aaa')*hv.Curve((x, 0.5*y), label='b')).options(options_dict)
renderer = hv.renderer('matplotlib').instance(fig='pdf')
renderer.save(img, 'file_name', style=dict(Image={'cmap':'jet'}))
img

結果

image.png

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0