Antony Joy
Antony Joy

Reputation: 301

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')

I AM GETTING AN ERROR- PlotlyError: The figure_or_data positional argument must be dict-like, list-like, or an instance of plotly.graph_objs.Figure

Upvotes: 1

Views: 5651

Answers (1)

vestland
vestland

Reputation: 61104

You haven't provided your imports in your code snippet, and it's hard to tell why you're using py.iplot. But you use import plotly.graph_objects as go you can just replace py.iplot(data,filename='basic') with:

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

Plot:

enter image description here

Complete code:

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()

Upvotes: 2

Related Questions