2017-11-04 14 views
0

私はこのメソッドを初めて使います。次の入力を作成しましたが、空の出力が得られます。私は何を取りこぼしたか?ありがとうございました。Bokehの単純な棒グラフ

import pandas as pd 
from bokeh.charts import Bar 
import pandas as pd 
from bokeh.plotting import figure, output_file, show 
mortality_age = pd.read_csv("mortality_by_age.csv") 
x=mortality_age["Age Range"] 
y=mortality_age["Deaths per 100,000 Live Births:"] 
plot = figure(title="Example of a vertical bar chart") 
plot.vbar(x, top=y, width=0.5,color="#CAB2D6") 
output_file("vertical_bar.html", mode="inline") 
show(plot) 

答えて

0

どのBokehのバージョンを使用していますか?

12.10を使用して、documentationに含まれている例を使用して、以下のコードを使用して表示するプロットを取得できました。

# import pandas as pd 
from bokeh.plotting import figure, output_file, show 
# from bokeh.charts import Bar # I had issues with this line working 
# mortality_age = pd.read_csv("mortality_by_age.csv") 
# x=mortality_age["Age Range"] 
# y=mortality_age["Deaths per 100,000 Live Births:"] 
x=[1, 2, 3, 4, 5] 
y=[6, 7, 6, 4, 5] 
plot = figure(title="Example of a vertical bar chart") 
plot.vbar(x=[1, 2, 3, 4, 5], top=y, width=0.5, color="#CAB2D6") 
output_file("vertical_bar.html", mode="inline") 
show(plot) 

私の推奨事項は、使用しているボケのバージョンを確認し、次に何がそこに存在しない、それは可能かもしれないあなたのcsvファイルに含まれるデータをチェックすることです。

関連する問題