- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 Bokeh vbar 与 RangeTool 一起使用。我尝试了许多不同的代码行,但这仍然不起作用。我不明白“浏览器”的错误
相同的代码适用于线条或散点
这是错误:
TypeError: argument of type 'Figure' is not iterable
这是下面的代码:
from bokeh.io import show
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, RangeTool
from bokeh.plotting import figure
from bokeh.models import Range1d
x = [1,2,3,4,5,6,7,8]
wdth = [0.5 for x in range(0,8)]
top = [8,7,6,5,4,3,2,1]
sourceRT5 = ColumnDataSource(data=dict(x=x, width=wdth, top=top))
p = figure(plot_height=300, plot_width=800,
tools="", toolbar_location=None,
x_axis_type="linear")
p.vbar('x', 'width', 'top', bottom=0, line_color='dodgerblue',
fill_color="dodgerblue", legend='New Words',
source=sourceRT5)
p.yaxis.axis_label = 'Price'
select = figure(plot_height=50, plot_width=800, y_range=(0,10),
x_axis_type="linear", y_axis_type=None,
tools="", toolbar_location=None)
range_rool = RangeTool(x_range=Range1d(3,8))
range_rool.overlay.fill_color = "navy"
range_rool.overlay.fill_alpha = 0.2
select.vbar('x', 'width', 'top', source=sourceRT5)
select.ygrid.grid_line_color = None
select.add_tools(range_rool)
select.toolbar.active_multi = range_rool
show(p,select)
有关错误的更多信息:
File "FromInt.py", line 6433, in testrangeVBar
show(p,select)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bokeh/io/showing.py", line 137, in show
return _show_with_state(obj, state, browser, new, notebook_handle=notebook_handle)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bokeh/io/showing.py", line 165, in _show_with_state
controller = get_browser_controller(browser=browser)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bokeh/util/browser.py", line 47, in get_browser_controller
controller = webbrowser.get(browser)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/webbrowser.py", line 34, in get
if '%s' in browser:
TypeError: argument of type 'Figure' is not iterable
最佳答案
您似乎正在尝试显示多个数字。 show
接受一个应该显示的对象,第二个参数是应该使用哪个浏览器(例如 firefox、chrome、IE、vivaldi...)。当你写它与分散一起工作时,我猜它没有抛出错误,但实际上并没有工作。
Bokeh 有一些documentation on displaying multiple plots 。简而言之,您需要告诉它应该以哪种方式布局它。一个非常通用的函数是 layout
:
from bokeh.layouts import layout
... # your code without show(...)
show(layout([p,select]))
关于python - 如何同时显示两个 Bokeh 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52287976/
我用 bokeh.plotting.Figure.line 画了下面的图。我如何添加垂直引用线来强调 Feb/14 的一个点? 这是另一个情节。这是 bokeh.charts.Bar。我想添加水平指南
我使用 python 在 Bokeh 中创建了一个散点图。我想创建一个小部件,允许用户更改散点图中点的颜色。有没有简单的方法可以做到这一点?我找到了一个基于 JQuery 的颜色选择器小部件 ( ht
我有一个 bokeh 应用程序,我可以在其中读取各种文件(6 到 12 个)并生成 DataTable 来比较几个不同的变量。 所以我有一个生成 DataTable 的循环,将它们添加到列表中,然后最
典型的 Bokeh 散点图可能如下所示: 其中 x 和 y 限制均为 [0,1]。如何删除轴上 0 之前并延伸到 1 之外的额外空间?这样最终图的左角为坐标 (0,0),左上角和右下角分别为 (0,1
我正在尝试创建一个 Bokeh 图,它允许我通过单击复选框来切换图中线条的可见性。 我开始尝试对复选框组使用 js 回调,但不幸的是,实际上并没有为复选框组实现 js 回调。 任何人都可以提出另一种方
例如,我有 button = Button(label="0", type="success") 选择此按钮后,我想将标签更改为“1”,反之亦然。有没有简单的方法来实现这一目标? 编辑: RadioB
我团队中的一些人,包括我自己,发现在 Bokeh 散点图中使用 circle 非常令人迷惑。方法,对于图中数据的初始自动缩放拟合,我们可以为我们的数据拨入合理的大小,例如使用 plot.circle(
所以我想做的是一个带有线条和圆圈的简单图形 http://docs.bokeh.org/en/latest/docs/quickstart.html#getting-started 但带有在鼠标悬停在
考虑一个垂直堆积条形图,其中每一列都由多个条形(段)组成。是否可以在每个段上添加工具提示?目前,相同的工具提示附加到组成该列的所有段。 from bokeh.core.properties impor
In[21]: from bokeh.charts import Bar, output_file, show In[22]: dict = {'sec': {u'A': 10, u'B': 20}}
在 Bokeh 中实现树形图需要什么?类似于这个 DS 示例的东西会很好—— http://bl.ocks.org/robschmuecker/7880033 我只是想可视化一个数据结构,所以只需要平
我了解如何指定在 Bokeh 中显示的特定刻度,但我的问题是是否有一种方法可以分配特定的标签来显示与位置。例如 plot.xaxis[0].ticker=FixedTicker(ticks=[0,1]
有什么方法可以为图例添加标题,例如左侧为当前图例,右侧为带有标题的图例。这个特殊的图例被放置在情节之外,所以我不知道是否可以用文本字形来伪造它。 最佳答案 从最新版本的 Bokeh (1.2) 开始,
问题:我的 python 应用程序启动了一个 Bokeh 服务器,如本文所述: http://matthewrocklin.com/blog/work/2017/06/28/simple-bokeh-
我正在使用 Bokeh 图制作折线图,我想标记实际的点(用线穿过它们),而不是仅仅标记线本身。我怎样才能做到这一点?我浏览了文档和用户指南,但似乎找不到答案。谢谢! 最佳答案 假设您正在使用 boke
我将一个 Bokeh Figure 实例作为输入传递给另一个函数,我需要在那里修改它的源代码。 不知道该怎么做! 这就是我创建图形实例的方式: source = ColumnDataSource({'
据我所知,我可以通过设置 responsive=True 来使 Bokeh 图响应 div 的宽度。然而,我感兴趣的是让 Bokeh 图只在一定程度上做出响应。有没有一种方法可以让我设置 Bokeh
我有一个 Bokeh 服务器应用程序。我想在命令行上传递自定义选项: bokeh serve /path/to/script.py --my-option foo 这可能吗? Bokeh 会以某种方式
我有一个图,它使用来自一些原始数据的值(在 0-20 的 x/y 范围内),以及一些导致一些相当大的 x/y 值(例如 -1000 到 1000+)的最小化数据。因此,我所做的绘图需要我手动单击缩放以
在Web应用程序中,我想让用户使用bokeh的漂亮的框/套索选择工具来选择绘制图像中的感兴趣区域。我想接收选定的像素,以便在python中进行进一步的操作。 对于散点图,这类似于gallery,很容易
我是一名优秀的程序员,十分优秀!