Text and Annotation for timeline plots (Gantt plot)

Hi @HansPeter123,
You are not supposed to pass the textposition argument inside the timeline() method, changes to the text and annotation are passed into the fig.update_traces() method.

Like this:

import plotly.express as px
import pandas as pd

df = pd.DataFrame([
    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 = px.timeline(df, x_start="Start", x_end="Finish", y="Task", text='Task') # textposition argument not possible
fig.update_traces(textposition='outside')
fig.show()
1 Like