Hello :),
I’m preparing a demonstration with tons of graph and tables to show what I can do with Python for future job interviews.
So I tried to do a Gantt chart with a list of students entering and exiting a language school at different dates. The data was recognized as expected. Except the text of the y axis is cropped and will only display about 11 characters.
I’ve tried to fix the problem without success:
- I’ve read the help of iplot and gantt_chart to see if I was missing an argument. Tried modifying the width of the chart but it doesn’t change the width of the y axis
- I’ve tried adding an angle to the y axis. This did work with angles over 40° or something but it doesn’t look good in this example. Besides I’m looking for a more universal solution to accept like 50 characters without a problem.
- I’ve tried modifying the jupyter’s notebook width to 100%. The notebook did change but not the graph.
Note: Initials or abbreviations could be considered but in this example it would be impractical. Also there are much more than 6 students in the final demonstration.
I’d like to point out that the example of plotly itself suffers the same issue: see page https://plot.ly/python/gantt/ look at the output n°7 the M of morning sleep is cropped.
Does anybody have an idea ?
Code:
import pandas as pd
from plotly.offline import init_notebook_mode, iplot
from plotly.graph_objs import *
init_notebook_mode(connected=True) # initiate notebook for offline plot
import plotly.figure_factory as ff
df_gantt2 =pd.DataFrame([
{'Task': 'Anthony Clark', 'Start': '2017-12-13', 'Finish': '2018-02-23'},
{'Task': 'Ariosto Li Fonti', 'Start': '2017-12-15', 'Finish': '2018-01-23'},
{'Task': 'Cettina Trevisano', 'Start': '2017-12-20', 'Finish': '2018-03-08'},
{'Task': 'Dora Padovesi', 'Start': '2018-01-11', 'Finish': '2018-01-12'},
{'Task': 'Emmeline Déziel', 'Start': '2018-01-22', 'Finish': '2018-03-25'},
{'Task': 'Sawa Tretyakov', 'Start': '2018-12-03', 'Finish': '2018-12-31'},])
fig = ff.create_gantt(df_gantt2, colors=['#333F44', '#93e4c1'],title='Students\' presence (those are fake names)',show_colorbar=True, bar_width=0.2, showgrid_x=True, showgrid_y=True)
iplot(fig,filename = 'students-presence-gantt')
Result: