首页 > 解决方案 > 情节图不可见

问题描述

我在 jupyter-lab 中的绘图有问题。主要是情节。当我执行代码时,不显示绘图。这个问题我该怎么办?如何使情节可见?

示例代码:

import plotly.graph_objects as go

from datetime import datetime

open_data = [33.0, 33.3, 33.5, 33.0, 34.1]
high_data = [33.1, 33.3, 33.6, 33.2, 34.8]
low_data = [32.7, 32.7, 32.8, 32.6, 32.8]
close_data = [33.0, 32.9, 33.3, 33.1, 33.1]
dates = [datetime(year=2013, month=10, day=10),
         datetime(year=2013, month=11, day=10),
         datetime(year=2013, month=12, day=10),
         datetime(year=2014, month=1, day=10),
         datetime(year=2014, month=2, day=10)]

fig = go.Figure(data=[go.Ohlc(x=dates,
                          open=open_data, high=high_data,
                          low=low_data, close=close_data)])
fig.show()

和输出屏幕: 在此处输入图像描述

jupyter labextension 列表:

(base) C:\Users\Dell>jupyter labextension list
JupyterLab v3.0.11
C:\Users\Dell\anaconda3\share\jupyter\labextensions
        atoti-jupyterlab v0.5.4 enabled ok
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled ok (python, jupyterlab_widgets)
        @pyviz/jupyterlab_pyviz v2.0.1 enabled ok (python, pyviz_comms)

jupyter 服务器扩展列表:

(base) C:\Users\Dell>jupyter server extension list
Config dir: C:\Users\Dell\.jupyter

Config dir: C:\Users\Dell\anaconda3\etc\jupyter
    jupyterlab enabled
    - Validating jupyterlab...
      jupyterlab 3.0.11 ok
    nbclassic enabled
    - Validating nbclassic...
      nbclassic  ok

Config dir: C:\ProgramData\jupyter

标签: python-3.xplotlyjupyter-lab

解决方案


这运作良好。我已经在我这边检查过了。请检查这个。 执行


推荐阅读