2017-07-28 19 views
0

を動作していないと、コードは正常に動作しますが、表示用HTMLファイルは私にエラーを与えます。ボケジッタは、私は重複する値が重ならないように、プロットにジッタを追加しようとしている

コード:

from bokeh.plotting import figure 
from bokeh.io import output_file, show 
from bokeh.models import ColumnDataSource, Jitter 

x = [1,2,3,4,5,3,3,3] 
y = [1,2,2,4,5,2,3,3] 

data = ColumnDataSource(dict(x=x, y=y)) 

output_file("iris.html") 

f=figure() 

f.plot_width = 800 
f.plot_height = 800 
f.sizing_mode="stretch_both" 

f.circle(x={'value': "x", 'transform': Jitter(width=0.4)}, y="y", source=data) 

show(f) 

私はHTMLファイルを開いたときに私が得るエラーは次のとおりです。

Bokeh Error 
Number property 'x' given invalid value: "x" 

答えて

1

偉大なエラーメッセージはありませんが、問題は、あなたが変換しようとしているありますデータソースのフィールド「x」ではなく「x」の値。それは動作します:

f.circle(x={'field': "x", 'transform': Jitter(width=0.4)}, y="y", source=data) 
+0

ありがとう!それはそれを修正した。 – Tony

関連する問題