有没有办法在 Jupyter Lab 中对 Holoviews 使用 hv.archive?

Is there a way to use hv.archive for Holoviews in Jupyter Lab?

我正在尝试在 Jupyter Lab 中使用 HoloViews hv.archive 功能,但是当我 运行 代码时没有生成存档。

当我运行:

hv.archive.auto()

df.testplot() # create holoviews plot

hv.archive.contents()

hv.archive.export()

我明白了:Javascript Error: IPython is not defined

在 Jupyter Notebook 中 运行ning 时,我没有收到错误消息并创建了存档文件夹,但我仍然无法生成存档图。

任何前进的方式将不胜感激。谢谢!

目前 hv.archive() 不适用于 Jupyter Lab,但它应该适用于 Jupyter Notebook。

查看此 github 问题:
https://github.com/holoviz/holoviews/issues/3570

如果我在 Jupyter Notebook 中 运行 下面的代码,它对我有用。
注意:运行下面的代码不是一次全部,而是一部分一部分。
否则我认为文件系统跟不上你会得到一个错误。

import holoviews as hv

# you can also choose the bokeh backend, but
# no .svg image will be saved
hv.extension('matplotlib')

# start archiving automatically
hv.archive.auto()

# create a simple plot
hv.Curve(range(0,3))

# check contents of current archive
hv.archive.contents()

# export archive to disk
hv.archive.export()

# check status of export
hv.archive.last_export_status()

# recreate simple plot from archive    
import os
from holoviews.core.io import Unpickler
path = os.path.join(hv.archive.notebook_name, 'Curve.hvz')

if os.path.isfile(path):
    obj = Unpickler.load(open(path,"rb"))
    print(obj)

obj

这是导出到磁盘时我的档案的样子:

有关存档的更多信息 可在此处找到:
http://holoviews.org/user_guide/Exporting_and_Archiving.html