Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! ✅Check out the new docs.

Problem with the Dashboard Tutorial

Hello, everyone :). I’m trying to follow the tutorial to make for first time a Dashboard, from your site: https://plot.ly/python/create-online-dashboard. I’m working with jupyter notebnook and Python 2.7 in Ubuntu.

At “Choose PlotI”:

import plotly.graph_objs as go
import plotly.plotly as py

import numpy as np

colorscale = [[0, ‘#FAEE1C’], [0.33, ‘#F3558E’], [0.66, ‘#9C1DE7’], [1, ‘#581B98’]]
trace1 = go.Scatter(
y = np.random.randn(500),
mode=‘markers’,
marker=dict(
size=‘16’,
color = np.random.randn(500),
colorscale=colorscale,
showscale=True
)
)
data = [trace1]
url_1 = py.plot(data, filename=‘scatter-for-dashboard’, auto_open=False)
py.iplot(data, filename=‘scatter-for-dashboard’)

I got the following error:

w, snap! We don’t have an account for ‘’. Want to try again? You can authenticate with your email address or username. Sign in is not case sensitive.

Don’t have an account? plot.ly

Questions? support@plot.ly


IndexError Traceback (most recent call last)
in ()
17 data = [trace0, trace1, trace2, trace3]
18
—> 19 url_2 = py.plot(data, filename=‘box-plots-for-dashboard’, sharing=‘secret’, auto_open=False)
20 py.iplot(data, filename=‘box-plots-for-dashboard’)

/home/gatos/.local/lib/python2.7/site-packages/plotly/plotly/plotly.pyc in plot(figure_or_data, validate, **plot_options)
238 if ‘share_key=’ not in url:
239 # add_share_key_to_url updates the url to include the share_key
–> 240 url = add_share_key_to_url(url)
241
242 if plot_options[‘auto_open’]:

/home/gatos/.local/lib/python2.7/site-packages/plotly/plotly/plotly.pyc in add_share_key_to_url(plot_url, attempt)
1308 “”"
1309 urlsplit = six.moves.urllib.parse.urlparse(plot_url)
-> 1310 username = urlsplit.path.split(’/’)[1].split(’~’)[1]
1311 idlocal = urlsplit.path.split(’/’)[2]
1312 fid = ‘{}:{}’.format(username, idlocal)

IndexError: list index out of range

I hope you can understand my problem. Thank you for reading me,
Regards

@Karachay You should have a Plotly account to post the plot on the Plotly cloud. To sign up go to this page:
https://help.plot.ly/how-to-sign-up-to-plotly/ and click on SIGN UP, in the upper right corner.

Once you have an account choose Settings from the upper right dropdown menu, and then click on the API keys and Regenerate Key. Copy the generated key and save it somewhere to use it when you post a new plot. Namely, sign in via the line of code, inserted before py.iplot():
py.sign_in('your_username', 'your_API_key)

That’s all :slight_smile: