簡體   English   中英

PlotlyError:`figure_or_data` 位置參數必須是 `dict`-like、`list`-like 或 plotly.graph_objs.Figure 的實例

[英]PlotlyError: The `figure_or_data` positional argument must be `dict`-like, `list`-like, or an instance of plotly.graph_objs.Figure

a=np.linspace(start=0,stop=36,num=36)
np.random.seed(25)
b=np.random.uniform(low=0.0,high=1.1,size=36)
trace=go.Scatter(x=a,y=b)
data=trace
py.iplot(data,filename='basic')

我收到一個錯誤 - PlotlyError: figure_or_data位置參數必須是dict -like、 list -like 或 plotly.graph_objs.Figure 的實例

你沒有在你的代碼片段中提供你的導入,而且很難說出你為什么使用py.iplot 但是您使用import plotly.graph_objects as go您可以將py.iplot(data,filename='basic')替換為:

fig = go.Figure(data)
fig.show()

Plot:

在此處輸入圖像描述

完整代碼:

import numpy as np
import plotly.graph_objects as go

a=np.linspace(start=0,stop=36,num=36)
np.random.seed(25)
b=np.random.uniform(low=0.0,high=1.1,size=36)
trace=go.Scatter(x=a,y=b)
data=trace
# py.iplot(data,filename='basic')
fig = go.Figure(data)
fig.show()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM