Help us understand the problem. What is going on with this article?

Holoviewsのファイル保存及びgrid上に並べるメモ

More than 3 years have passed since last update.

Holoviewsとはmatplotlib plotly bokehなどのwrapperである。
公式: http://holoviews.org/
基本的な使い方: https://qiita.com/driller/items/53be86cea3c3201e7e0f

file出力

形式を選ぶ
renderer = hv.renderer('bokeh').instance(fig='html')
renderer = hv.renderer('matplotlib').instance(fig='png')

出力のpathを指定
renderer.save(gridspace, 'fname', style=dict(Image={'cmap':'jet'}))

grid上に並べる

dict = {(x,y): holoviewsのplotオブジェクト}
hv.GridSpace(dict, kdims=['x_name','y_name'])

sample code

import numpy as np
import holoviews as hv

def sine_curve(phase, freq):
    xvals = [0.1* i for i in range(100)]
    return hv.Curve((xvals, [np.sin(phase+freq*x) for x in xvals]))

phases      = [0, np.pi/2, np.pi, 3*np.pi/2]
frequencies = [0.5, 0.75, 1.0, 1.25]
curve_dict_2D = {(p,f):sine_curve(p,f) for p in phases for f in frequencies}
gridspace = hv.GridSpace(curve_dict_2D, kdims=['x', 'y'])
#renderer = hv.renderer('bokeh').instance(fig='html')
renderer = hv.renderer('matplotlib').instance(fig='png')
renderer.save(gridspace, 'fname', style=dict(Image={'cmap':'jet'}))

ymd_
機械学習やってます
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away