3

As per the question, I'm trying to plot a simple figure using plotly in google colab, but I get a blank figure instead. I followed this and this and didn't work.

This is my code:

Cell1

import plotly.graph_objs as go
from  plotly.offline import iplot, init_notebook_mode, plot
import numpy as np

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-latest.min.js?noext',
            },
          });
        </script>
        '''))

Cell2

x = np.arange(10)
y = np.random.random(10) * 3 + x

trace = go.Scatter(x=x, y=y)
configure_plotly_browser_state()
init_notebook_mode(connected=False)
iplot([trace])

EDIT: Issue solved in version 4.0.0

Tarifazo
  • 4,118
  • 1
  • 9
  • 22

0 Answers0