python - 将全息图与 hvPlot 结合使用

标签 python holoviews hvplot

是否可以使用 hvPlot 生成 HoloMap?我在文档中没有找到任何引用。

目标是创建类似此处示例的内容: http://holoviews.org/reference/containers/bokeh/HoloMap.html#bokeh-gallery-holomap

但使用 hvPlot 接口(interface)

最佳答案

这绝对是可能的,主要要求是您的数据格式整齐。在这种情况下,您可以使用 groupby 关键字获取 DynamicMapHoloMap 来探索沿该维度的数据。例如,让我们调整您指向的链接中的示例:

frequencies = [0.5, 0.75, 1.0, 1.25]

def sine_curve(phase, freq):
    xvals = np.arange(100)
    yvals = np.sin(phase+freq*xvals)
    return pd.DataFrame({'x': xvals, 'y': yvals, 'phase': phase, 'freq': freq}, columns=['x', 'y', 'phase', 'freq'])

df = pd.concat([sine_curve(0, f) for f in frequencies])

df.hvplot.line('x', 'y', groupby='freq', dynamic=False)

enter image description here

在这里,我们创建一个 DataFrame,其中包含多个不同频率的 x 和 y 值,将它们连接起来,然后沿“freq”列应用 groupby 以获取该维度的 slider 。为了确保它返回 HoloMap 而不是 DynamicMap,我们还设置了 dynamic=False

关于python - 将全息图与 hvPlot 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56288229/

相关文章:

python - 检查excel表中的缺失值

python reload 模块没有立即生效

python - 使用 python 解析电子邮件日期时间

python - 在 Google Colab 中使用全息 View 时出现此错误 - 无法导入名称 'future_add_done_callback'

Python - Holoviews没有图像

python - OpenERP 6.1中创建菜单项时访问规则禁止的操作

matplotlib - 如何为 Holoviews 图像设置 `vmin` 和 `vmax`?

python - 高压图 : Plotting multiple lines with null values

python - hvplot/holoviews (bokeh) 带负值格式化程序的时间增量轴

python - 如何在dask中绘制直方图?