Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

First steps of python plotting - need help

Hello community,

Thanks for all the great work.
Not so beginner in SQL / VBA / HTML CSS but surely so in PYthon, i’ve installed a fresh Python 2.7, pip, matplotlib, panda, plotly, numpy and jupyter.
Those are my first steps with PYthon and i would like to be able to generate offline graphics and then loaded with external csv/txt data.

i copy/paste some of the simple bar charts example clipboard in my shell, but then i kind of don’t know where the “result” goes ?
Where am i suppose to look at ?

Thanks for help,

I copy pasted the code snippet from the example provided and it worked. The way it worked is this - I created a .py file with the API token in it. When I ran the code it opened up a browser with the plotly site and as soon as I logged in, the plot created in the code was displayed in my account. I had saved the code in a file to use as a control to rerun.
Now I tried to plot a time series using Python and the error message suggests that all the steps worked and the only point it is failing is when it tries to open the browser to log in. I got the same error using the .py file that had worked earlier.
I am using a Windows environment and here is the error message I get:
Command “c:\python27\python.exe -u -c “import setuptools, tokenize;file=‘c:
\users\03307966\appdata\local\temp\pip-build-gjthsa\scipy\setup.py’;f=get
attr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.clo
se();exec(compile(code, file, ‘exec’))” install --record c:\users\03307966\a
ppdata\local\temp\pip-0o1vwx-record\install-record.txt --single-version-external
ly-managed --compile” failed with error code 1 in c:\users\03307966\appdata\loca
l\temp\pip-build-gjthsa\scipy\

The code that worked is:
import plotly
plotly.tools.set_credentials_file(username=‘xxxx’, api_key=‘add your own’)
import plotly.plotly as py
plotly.tools.set_config_file(world_readable=False, sharing=‘private’)
from plotly.graph_objs import *

trace0 = Scatter(
x=[1, 2, 3, 4],
y=[10, 15, 13, 17]
)
trace1 = Scatter(
x=[1, 2, 3, 4],
y=[16, 5, 11, 9]
)
data = Data([trace0, trace1])

py.plot(data, filename = ‘basic-line’)
py.image.save_as({‘data’:data},‘test01.png’) # workoffline and save your output on your drive instead of your plotly account

need to find a way to change private to public in settings somewhere as the limit applies to private not public

Thanks for the reply.

I kind of get the hang of of it now, thanks to you too.

See you later !
F.