Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KeyError: 'plotly_domain'

I am running the code from here:

import plotly
import plotly.plotly as py
from plotly.tools import FigureFactory as FF

import numpy as np
import pandas as pd
print(plotly.__version__)
dataframe = pd.DataFrame(np.random.randn(100, 3),
                         columns=['Column A', 'Column B', 'Column C'])

fig = FF.create_scatterplotmatrix(dataframe, diag='histogram', index='Column A',
                                  colormap=['rgb(100, 150, 255)', '#F0963C', 'rgb(51, 255, 153)'],
                                  colormap_type='seq', height=800, width=800)
py.iplot(fig, filename = 'Custom Sequential Colormap')

And I get this error:

/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /Users/mona/PycharmProjects/PythonCodes/plotly_viz.py
1.12.4
This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]
[ (2,1) x3,y3 ]  [ (2,2) x4,y4 ]

Traceback (most recent call last):
  File "/Users/mona/PycharmProjects/PythonCodes/plotly_viz.py", line 14, in <module>
    py.iplot(fig, filename = 'Custom Sequential Colormap')
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/plotly/plotly/plotly.py", line 175, in iplot
    return tools.embed(url, **embed_options)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/plotly/tools.py", line 443, in embed
    != session.get_session_config()['plotly_domain']):
KeyError: 'plotly_domain'

Process finished with exit code 1

Do you know what is the problem and how can it be solved? I was trying plotly out but even my first try happened to be unsuccessful!

like image 432
Mona Jalal Avatar asked Dec 18 '22 14:12

Mona Jalal


1 Answers

Based on this answer, try using py.plot instead of py.iplot.

KeyError: 'plotly_domain' when using plotly to do scatter plot in python

The reason is that iplot is for ipython sessions.

like image 96
Plasma Avatar answered Dec 21 '22 11:12

Plasma