1

I'm trying to create a gantt chart with plotly in an offline Jupyter notebook, mashing together the Gantt chart tutorial and the offline tutorial, I tried this:

import plotly.plotly as py
import plotly.figure_factory as ff
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

init_notebook_mode(connected=True)

dfoo = [dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28'),
      dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15'),
      dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30')]
fig = ff.create_gantt(dfoo)
py.iplot(fig)

But this only returns an error about the plotly API, which shouldn't happen if I'm offline...

PlotlyRequestError: Aw, snap! You tried to use our API as the user ___, but the supplied API key doesn't match our records. 

I can plot other charts offline, is there a way to use figure factory and plot offline?

2 Answers 2

1

You can also use plotly.offline.plot(fig) if you import plotly, it doesn't work for 'plotly.plotly' though.

Sign up to request clarification or add additional context in comments.

Comments

0

Oh, shoot, it was a very simple mistake.

py.iplot(fig) calls the online version of plotly while iplot(fig) calls the offline version.

This works for me

dfoo = [dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28'),
      dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15'),
      dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30')]
fig = ff.create_gantt(dfoo)
iplot(fig)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.