bokeh ソース コードを使用します。バージョンは0.5.1です
ソース コードは bokeh のホームページにあります。ソース コードはヒストグラムです。
操作ではなく、
# -*- coding: utf-8 -*-
import numpy as np
import scipy.special
from bokeh.plotting import *
mu, sigma = 0, 0.5
measured = np.random.normal(mu, sigma, 1000)
hist, edges = np.histogram(measured, density=True, bins=50)
x = np.linspace(-2, 2, 1000)
pdf = 1/(sigma * np.sqrt(2*np.pi)) * np.exp(-(x-mu)**2 / (2*sigma**2))
cdf = (1+scipy.special.erf((x-mu)/np.sqrt(2*sigma**2)))/2
output_file('histogram.html')
hold()
figure(title="Normal Distribution (횓쩌=0, 횕혘=0.5)",tools="previewsave",
background_fill="#E8DDCB")
quad(top=hist, bottom=0, left=edges[:-1], right=edges[1:], fill_color="#036564", line_color="#033649")
show()
コンパイルエラー --->
トレースバック (最新の呼び出しが最後): ファイル "E:\workspace\python\anaconda\test\temp1.py"、22 行目、quad(top=hist、bottom=0、left=edges[:-1]、right) =edges[1:], fill_color="#036564", line_color="#033649") ファイル "C:\Users\junseok\Anaconda\lib\site-packages\bokeh\plotting.py"、336 行目、ラッパーretval = func(curdoc(), *args, **kwargs) File "C:\Users\junseok\Anaconda\lib\site-packages\bokeh_glyph_functions.py", line 54, in func y_data_fields = [ glyph_params[yy][ 'field'] for yy in yfields if glyph_params[yy]['units'] == 'data' ] TypeError: 'int' object has no attribute ' getitem '