调用时如何指定 firefox 身份 bokeh.show
How to specify a firefox identity when calling bokeh.show
我正在使用散景进行一些交互式数据分析。我为这项工作使用了一个单独的 firefox 配置文件,而不是我为其他浏览器所做的配置文件,并且我希望能够在我 运行 脚本时让 bokeh 打开具有这个其他标识的选项卡。一般形式是
from bokeh.client import push_session
from bokeh.io import curdoc
from bokeh.plotting import show
[analysis setup]
session = push_session(curdoc())
session.show(*args, **kwargs)
目前,args
和kwargs
只有网格布局信息。 运行 此脚本在默认的 Firefox 实例中打开一个选项卡。然后我可以通过 运行ning
使用我想要的 firefox 配置文件打开它
$ firefox -P --no-remote ipython --new-tab http://localhost:5006/?bokeh-session-id=xIjdv4HI8MR1xTkWf8iR5fauYKHvp3wDc3Zre5fv444o
从命令行。从那以后一切正常,但我想让 bokeh 打开一个带有新配置文件的选项卡,而无需额外的步骤。 session.show 的文档只告诉我可以指定制表符或 window,但没有进一步说明。
Bokeh 0.12.3 中修复了一个错误。您可以将浏览器设置为使用 like:
from bokeh.client import push_session
from bokeh.io import curdoc
from bokeh.plotting import figure, show
# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
# create a new plot with a title and axis labels
p = figure(title='simple line example', x_axis_label='x', y_axis_label='y')
# add a line renderer with legend and line thickness
p.line(x, y, legend='Temp.', line_width=2)
# HERE you define the custom browser
# custom_firefox_bg = '/usr/bin/firefox -P ipython --new-tab %s &'
custom_firefox = '/usr/bin/firefox -P ipython --new-tab %s'
session = push_session(curdoc())
session.show(obj=p, browser=custom_firefox)
%s
将被 URL 取代。如果命令以 &
结尾,那么浏览器将在后台打开,不会阻止您的 Python 脚本。
我正在使用散景进行一些交互式数据分析。我为这项工作使用了一个单独的 firefox 配置文件,而不是我为其他浏览器所做的配置文件,并且我希望能够在我 运行 脚本时让 bokeh 打开具有这个其他标识的选项卡。一般形式是
from bokeh.client import push_session
from bokeh.io import curdoc
from bokeh.plotting import show
[analysis setup]
session = push_session(curdoc())
session.show(*args, **kwargs)
目前,args
和kwargs
只有网格布局信息。 运行 此脚本在默认的 Firefox 实例中打开一个选项卡。然后我可以通过 运行ning
$ firefox -P --no-remote ipython --new-tab http://localhost:5006/?bokeh-session-id=xIjdv4HI8MR1xTkWf8iR5fauYKHvp3wDc3Zre5fv444o
从命令行。从那以后一切正常,但我想让 bokeh 打开一个带有新配置文件的选项卡,而无需额外的步骤。 session.show 的文档只告诉我可以指定制表符或 window,但没有进一步说明。
Bokeh 0.12.3 中修复了一个错误。您可以将浏览器设置为使用 like:
from bokeh.client import push_session
from bokeh.io import curdoc
from bokeh.plotting import figure, show
# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
# create a new plot with a title and axis labels
p = figure(title='simple line example', x_axis_label='x', y_axis_label='y')
# add a line renderer with legend and line thickness
p.line(x, y, legend='Temp.', line_width=2)
# HERE you define the custom browser
# custom_firefox_bg = '/usr/bin/firefox -P ipython --new-tab %s &'
custom_firefox = '/usr/bin/firefox -P ipython --new-tab %s'
session = push_session(curdoc())
session.show(obj=p, browser=custom_firefox)
%s
将被 URL 取代。如果命令以 &
结尾,那么浏览器将在后台打开,不会阻止您的 Python 脚本。