OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Tasks with the same name in Gantt diagram using plotly.express.timeline

  • Thread starter Thread starter Petr L
  • Start date Start date
P

Petr L

Guest
Is there a way to separate tasks on a Gantt diagram if they have the same names?

Code:
import plotly.express as px
import pandas as pd

df = pd.DataFrame([
    dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28', Worker='Alex'),
    dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15', Worker='John'),
    dict(Task="Job A", Start='2009-02-20', Finish='2009-05-30', Worker='Marc')
])

fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", color="Worker")
fig.update_yaxes(autorange="reversed") 
fig.show()

I want to show two jobs named "Job A" as separate tasks, not grouping and not in one line using opacity, and preferably not using deprecated plotly.figure_factory.create_gantt. Thanks in advance!
<p>Is there a way to separate tasks on a Gantt diagram if they have the same names?</p>
<pre><code>import plotly.express as px
import pandas as pd

df = pd.DataFrame([
dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28', Worker='Alex'),
dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15', Worker='John'),
dict(Task="Job A", Start='2009-02-20', Finish='2009-05-30', Worker='Marc')
])

fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", color="Worker")
fig.update_yaxes(autorange="reversed")
fig.show()
</code></pre>
<p>I want to show two jobs named "Job A" as separate tasks, not grouping and not in one line using opacity, and preferably not using deprecated <code>plotly.figure_factory.create_gantt</code>. Thanks in advance!</p>
 
Top