My figures in plotly are not showing using iplot

Hi, for some reason when i run the below code it does not show me my graph. I am using jupyter notebook and my plotly version is 4.1.1. Any ideas on what i need to do?

Import the necessaries libraries

import plotly.offline as pyo
import plotly.graph_objs as go

Set notebook mode to work in offline

pyo.init_notebook_mode()
#init_notebook_mode(connected=True)

Create traces

trace0 = 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 traces

data = [trace0, trace1]
layout=go.Layout(barmode=‘stack’)
fig=go.Figure(data=data, layout=layout)

Plot it and save as basic-line.html

pyo.iplot(fig, filename = ‘basic-line’)

Hello @zPlotlyUser, with version >= 4 you should not use the offline module anymore, but fig.show():

import plotly.graph_objs as go
trace0 = 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]
)
data = [trace0, trace1]
layout=go.Layout(barmode=‘stack’)
fig=go.Figure(data=data, layout=layout)
fig.show()

(see https://plot.ly/python/renderers/ and https://plot.ly/python/creating-and-updating-figures/)

thaks, i realised i just needed to update my browser

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online