You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

JupyterLab Desktop中%matplotlib widget与ipywidgets使用问题求助

JupyterLab Desktop中%matplotlib widget与ipywidgets使用问题求助

大家好,我在JupyterLab Desktop里使用%matplotlib widget时遇到了两个棘手的问题,想请教下社区的各位有没有解决办法:

  • 问题一:重复运行df.plot()无图表显示
    第一次执行df.plot()时完全正常,能看到完整的交互图表和光标,但再次运行同一代码时,只输出<Axes: >,看不到任何图表内容。

  • 问题二:widgets.interact()图表输出到日志而非面板
    使用widgets.interact()生成交互图表时,结果只会出现在日志文件里,而且没有交互光标。我尝试用Output控件来指定输出区域:

    out = widgets.Output(layout={'border': '1px solid black'})
    

    然后通过上下文管理器包裹显示代码:

    with out:
        display(widgets.VBox([
            widgets.GridBox(test.children[:nnn-4], layout=widgets.Layout(grid_template_columns="repeat(5, auto)")),
            test.children[nnn-4],
            test.children[nnn-3],
            test.children[nnn-2],
            test.children[nnn-1]
        ]))
    

    虽然VBox控件能正常显示在面板中,但图表还是跑到日志里去了,完全没出现在指定的Output区域。

请问有没有办法解决这两个问题呢?

备注:内容来源于stack exchange,提问作者Wick

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 12:04:29