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
相关产品推荐
相关产品推荐

