2017-11-04 3 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

어떤 버전의 보케를 사용하고 있습니까?

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 파일에 포함 된 데이터를 확인하는 것입니다.