Hi,
Can anyone help please. I am using version 3.10 of Plotly with Python 3.7.
The example code on the plotly site is:
import plotly.plotly as py
import plotly.figure_factory as ff
df = [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(df)
py.iplot(fig, filename=βgantt-simple-gantt-chartβ, world_readable=True)
This initially says that Numpy is missing so I have imported this libary. However, it then tells me that
plotly.tools.FigureFactory.create_gantt is deprecated. Use plotly.figure_factory.create_gantt
I altered the code around this, but it still generates other errors. I canβt find the reference for plotly.figure_factory.create_gantt to see what attributes, etc are available.
Can anyone help with this please as I am fairly new to this, but this will help me to develop a really useful utility I have been working on.
Thanks for your help.
Steve
Hi @stevebutler99,
Hereβs a full offline gantt chart example that Iβm running with 3.10.0.
import plotly.figure_factory as ff
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode()
df = [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(df)
iplot(fig)
You can use the built-in python help
function to view the documentation of the arguments to create_gantt
.
help(ff.create_gantt)
Help on function create_gantt in module plotly.figure_factory._gantt:
create_gantt(df, colors=None, index_col=None, show_colorbar=False, reverse_colors=False, title='Gantt Chart', bar_width=0.2, showgrid_x=False, showgrid_y=False, height=600, width=900, tasks=None, task_names=None, data=None, group_tasks=False)
Returns figure for a gantt chart
:param (array|list) df: input data for gantt chart. Must be either a
a dataframe or a list. If dataframe, the columns must include
'Task', 'Start' and 'Finish'. Other columns can be included and
used for indexing. If a list, its elements must be dictionaries
with the same required column headers: 'Task', 'Start' and
'Finish'.
...
Hope that helps!
-Jon
Thanks Jon, just trying this out.
Regards
Steve