亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

繪圖不顯示

繪圖不顯示

森林海 2022-06-14 17:02:39
我只是在嘗試繪圖/破折號,當我編寫下面的代碼時,什么都沒有顯示.. 它只是一個空白框。我已經嘗試安裝nodejs(我正在使用anaconda),以便我可以嘗試安裝一些擴展程序'jupyter labextension install @jupyterlab/plotly-extension',但這由于某種原因我什至無法安裝nodejs。import dashimport dash_core_components as dccimport dash_html_components as htmlimport plotly.offline as pyoimport plotly.graph_objs as go# Set notebook mode to work in offlinepyo.init_notebook_mode()#init_notebook_mode(connected=True)# Create tracestrace0 = go.Scatter(    x=[1, 2, 3, 4],    y=[10, 15, 13, 17])trace1 = go.Scatter(    x=[1, 2, 3, 4],    y=[16, 5, 11, 9])# Fill out data with our tracesdata = [trace0, trace1]layout=go.Layout(barmode='stack')fig=go.Figure(data=data, layout=layout)# Plot it and save as basic-line.htmlpyo.iplot(fig, filename = 'basic-line')我還能做些什么來幫助查看我的圖表?
查看完整描述

3 回答

?
慕的地10843

TA貢獻1785條經驗 獲得超8個贊

我想要更多關于 polty、Jupyterlab 等版本的信息,但iplot()很可能是這里的問題。嘗試另一個基本示例,例如:


代碼:


import plotly.graph_objects as go

animals=['giraffes', 'orangutans', 'monkeys']


fig = go.Figure(data=[

    go.Bar(name='SF Zoo', x=animals, y=[20, 14, 23]),

    go.Bar(name='LA Zoo', x=animals, y=[12, 18, 29])

])

# Change the bar mode

fig.update_layout(barmode='stack')

fig.show()

陰謀:

http://img1.sycdn.imooc.com//62a84ed00001b4ca08990385.jpg

讓我知道這對你有什么影響。



查看完整回答
反對 回復 2022-06-14
?
www說

TA貢獻1775條經驗 獲得超8個贊

你可以試試這個 Google Colab 已經給出了重新分級 Plotly 的指令


def configure_plotly_browser_state():

  import IPython

  display(IPython.core.display.HTML('''

        <script src="/static/components/requirejs/require.js"></script>

        <script>

          requirejs.config({

            paths: {

              base: '/static/base',

              plotly: 'https://cdn.plot.ly/plotly-1.5.1.min.js?noext',

            },

          });

        </script>

        '''))

調用此函數 configure_plotly_browser_state()


查看完整回答
反對 回復 2022-06-14
?
波斯汪

TA貢獻1811條經驗 獲得超4個贊

當您運行代碼并彈出瀏覽器時,單擊地址欄并按 Enter。



查看完整回答
反對 回復 2022-06-14
  • 3 回答
  • 0 關注
  • 221 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號