显示散景交叉滤镜示例 [英] Displaying Bokeh Crossfilter Example

查看:69
本文介绍了显示散景交叉滤镜示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从此处下载了Bokeh Crossfilter示例的存储库:

I dowloaded the repository for Bokeh Crossfilter example from here:

https://github.com/bokeh/bokeh/tree/master/examples/app/crossfilter

应该生成显示在此处的交互式图:

It is supposed to generate the interactive plot displayed here:

https://demo.bokeh.org/crossfilter

我在存储库中运行了main.py.但是,什么也没出现.然后我意识到代码没有显示布局.因此,我在最后添加了show(layout)行,该行的确在Web浏览器上显示了布局,但是当我为x和y轴选择不同的内容时,它不会更新绘图.我确实意识到show(layout)代码仅显示运行代码时的布局,而没有告诉它更新.但是,我无法弄清楚如何在网络浏览器上显示该图,使其仍然具有交互性(当我在浏览器上选择不同的轴时,会更新该图).

I ran main.py in the repository. However, nothing appeared. Then I realized the code does not show the layout. So I added the line show(layout) in the end, which did indeed display the layout on a web browser but it would not update the plot when I select different things for x and y axes. I do realize that show(layout) code only shows whatever the layout was at the moment of running the code and it is not telling it to update. However, I couldn't figure out how to show this plot on a web browser so that it is still interactive (would update the plot when I select different axes on the browser).

非常感谢您的帮助.谢谢!

I would much appreciate any help. Thank you!

推荐答案

http ://docs.bokeh.org/en/latest/docs/gallery.html 在图库中,您可以看到示例的第一部分属于bokeh服务器应用程序类别,并且需要bokeh服务器进行交互工作.

http://docs.bokeh.org/en/latest/docs/gallery.html In the gallery you can see the first section of examples fall under the bokeh server app category, and require a bokeh server to work interactively.

示例的第二部分是独立的(仅在浏览器中).

The second section of examples are standalone (in the browser only).

要完全运行该应用程序,请执行以下操作:下载文件夹的所有内容,然后将其保存在文件夹中,例如crossfilter.打开命令提示符(不在python中),然后键入bokeh serve --show crossfilter. 这将打开应用程序,并且应该响应用户交互.

To run the app corectly: download all the contents of the folder, and save them in the folder, say crossfilter. Open up the command prompt (not in python) and type bokeh serve --show crossfilter. This will open up the app and it should respond to user interaction.

从python运行show(layout)并从命令行提供bokeh应用可以实现的主要区别.

There is a key difference in what can be achieved in running show(layout) from python, and serving a bokeh app from the command line.

使用show(...)将在浏览器中显示内容,从这里开始python和浏览器之间没有连接,因此无法从python函数更新图.它只能使用javascript(在浏览器中运行). crossfilter示例中没有javascript回调,因此当您与任何事物进行交互时都不会发生任何事情.

Using show(...) will display the content within the browser, from here there is no connection between python and the browser, and therefore no way to update plots from python functions. It can only use javascript (which runs within the browser). There are no javascript callbacks within the crossfilter example, and therefore nothing will happen when you interact with anything.

Bokeh提供了服务器功能,该功能允许从python运行代码并根据用户交互更新图.从这里开始: http://docs.bokeh.org/en/Latest/docs/user_guide/server.html

Bokeh provides a server functionality, which allows code to be run from python and update plots on user interaction. Start from here: http://docs.bokeh.org/en/latest/docs/user_guide/server.html

这篇关于显示散景交叉滤镜示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆