【发布时间】:2016-03-23 23:15:12
【问题描述】:
我不确定这是否是个问题,因为图表当前正在 Bokeh 中更新,但我无法再在 Jupyter 笔记本中使用 Bokeh 中的折线图绘制完整的数据框。使用this example from the docs:
from collections import OrderedDict
import numpy as np
import pandas as pd
from bokeh.charts import Line
from bokeh.plotting import show, output_file
from bokeh.charts import Chart, Line
xyvalues = OrderedDict(
python=[2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120, 111],
pypy=[12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110, 130],
jython=[22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139, 160],
)
# any of the following commented are valid Line inputs
xyvalues = pd.DataFrame(xyvalues)
#xyvalues = xyvalues.values()
#xyvalues = np.array(xyvalues.values())
output_file("lines.html", title="line.py example")
chart = Line(xyvalues, title="Lines", ylabel='measures', legend=True)
show(chart)
我得到:Incorrect dataframe plot 这与文档中显示的示例明显不同。
如果我明确地给数据框一个索引并像下面那样传递所有列,那么它会给出预期的图:
xyvalues = pd.DataFrame(xyvalues, index=range(14))
output_file("lines.html", title="line.py example")
chart = Line(xyvalues, y=['python', 'pypy', 'jython'],
title="Lines", ylabel='measures', legend=True)
show(chart)
我的笔记本规格:
您正在使用 Jupyter 笔记本。
笔记本服务器的版本是 4.0.6,运行在: Python 2.7.11 |Anaconda 2.4.1(64 位)| (默认,2015 年 12 月 6 日,18:08:32) [GCC 4.4.7 20120313(红帽 4.4.7-1)]
IPython 4.0.1 -- 增强的交互式 Python。
【问题讨论】:
-
这可能是一个错误。不知道就很难说,例如您使用的是什么版本的散景。你能通过 GH 问题跟踪器来并在那里提出问题,以便核心开发人员可以看到这一点吗? github.com/bokeh/bokeh/issues
-
您使用的是哪个版本的
bokeh?0.11.0dev2对我来说可以正常工作 -
@Jake 我做了
import bokehbokeh.__version__并得到了'0.10.0'。 -
@bigreddot 问题在这里创建:github.com/bokeh/bokeh/issues/3371
标签: python-2.7 pandas bokeh jupyter-notebook