gpt4 book ai didi

python - HoloViews DynamicMap 悬停工具不会使用所选变量更新

转载 作者:行者123 更新时间:2023-12-03 21:04:24 28 4
gpt4 key购买 nike

我正在学习带有 Bokeh 后端的 HoloViews,并且正在制作 Pandas 数据帧所选列的 iPython/Jupyter 显示(实际上它是一个 xarray 数据集,但用数据帧显示问题更简单)。问题是,当我选择第一列/变量以外的任何列/变量时,悬停工具提示仍显示第一列/变量的值。我的代码大致基于 HoloViews dashboard docs .

import holoviews as hv
import pandas as pd
import numpy as np
hv.extension('bokeh')

df = pd.DataFrame()
df['time'] = pd.date_range('2018-01-01', '2018-01-31')
df['var1'] = np.linspace(0, 1, len(df['time']))
df['var2'] = np.ones(df['var1'].shape)

def load_symbol(var):
return hv.Curve(df, ('time', 'Time'), var)

variables = ['var1', 'var2']
dmap = hv.DynamicMap(load_symbol, kdims='Variable').redim.values(Variable=variables)

dmap.opts(framewise=True, tools=['hover'])

使用悬停工具选择第一个变量:
enter image description here
使用悬停工具选择第二个变量:
enter image description here

请注意,为 var1 显示了正确的工具提示值 (0.200)。 But when var2 is selected, the hover tool still shows the value for var1, even though the tooltip is in the correct place for var2.这里发生了什么?

最佳答案

显然这是全息 View 中的一个错误,正如开发人员回答的那样 here (issue #3609)
它在 holoviews 1.12.2 版本中得到了正式解决。
如果有人仍然遇到这个问题,升级到最新版本应该可以解决它。

关于python - HoloViews DynamicMap 悬停工具不会使用所选变量更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55288470/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com