Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jupyter Python笔记本:交互式散点图,其中每个数据点都与自己的图形相关联?_Python_Visualization_Jupyter_Interactive_Bokeh - Fatal编程技术网

Jupyter Python笔记本:交互式散点图,其中每个数据点都与自己的图形相关联?

Jupyter Python笔记本:交互式散点图,其中每个数据点都与自己的图形相关联?,python,visualization,jupyter,interactive,bokeh,Python,Visualization,Jupyter,Interactive,Bokeh,考虑一组数据点。每个数据点由两个数字和两个数组组成。例如,这两个数字可能是两个参数的值,这两个数组可能表示相关的时间过程数据。我想在Jupyter Python笔记本中生成一个内联散点图,其中我将两个数字相互关联。此外,我希望散点图是交互式的,这样,当我将光标悬停在数据点上时,会出现第二个图形,其中两个数组相对绘制。我该怎么做 是Bokeh中的一个示例,它与我想要的非常接近,但它只显示与每个点关联的浮动文本框,而不是图形。我应该说,如果图形没有浮动,而是锚定在散点图附近,我会更喜欢 谢谢 来自的

考虑一组数据点。每个数据点由两个数字和两个数组组成。例如,这两个数字可能是两个参数的值,这两个数组可能表示相关的时间过程数据。我想在Jupyter Python笔记本中生成一个内联散点图,其中我将两个数字相互关联。此外,我希望散点图是交互式的,这样,当我将光标悬停在数据点上时,会出现第二个图形,其中两个数组相对绘制。我该怎么做

是Bokeh中的一个示例,它与我想要的非常接近,但它只显示与每个点关联的浮动文本框,而不是图形。我应该说,如果图形没有浮动,而是锚定在散点图附近,我会更喜欢

谢谢

来自的“定义回调”可能会有所帮助。不方便,不完美,但可以实现你所描述的

from bokeh.models import ColumnDataSource, OpenURL, TapTool
from bokeh.plotting import figure, output_file, show

output_file("openurl.html")

p = figure(plot_width=400, plot_height=400,
           tools="tap", title="Click the Dots")

source = ColumnDataSource(data=dict(
    x=[1, 2, 3, 4, 5],
    y=[2, 5, 8, 2, 7],
    color=["navy", "orange", "olive", "firebrick", "gold"]
    ))

p.circle('x', 'y', color='color', size=20, source=source)

url = "http://www.colors.commutercreative.com/@color/"
taptool = p.select(type=TapTool)
taptool.callback = OpenURL(url=url)

show(p)
来自的“定义回调”可能会有所帮助。不方便,不完美,但可以实现你所描述的

from bokeh.models import ColumnDataSource, OpenURL, TapTool
from bokeh.plotting import figure, output_file, show

output_file("openurl.html")

p = figure(plot_width=400, plot_height=400,
           tools="tap", title="Click the Dots")

source = ColumnDataSource(data=dict(
    x=[1, 2, 3, 4, 5],
    y=[2, 5, 8, 2, 7],
    color=["navy", "orange", "olive", "firebrick", "gold"]
    ))

p.circle('x', 'y', color='color', size=20, source=source)

url = "http://www.colors.commutercreative.com/@color/"
taptool = p.select(type=TapTool)
taptool.callback = OpenURL(url=url)

show(p)