Skip to content

Commit 18c3451

Browse files
update(gantt-dependencies): seaborn — Fix dependency arrows to connect end→start and ensure correct temporal scheduling
1 parent e8c0489 commit 18c3451

4 files changed

Lines changed: 39 additions & 31 deletions

File tree

plots/gantt-dependencies/implementations/seaborn.py

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" pyplots.ai
1+
"""pyplots.ai
22
gantt-dependencies: Gantt Chart with Dependencies
3-
Library: seaborn 0.13.2 | Python 3.13.11
4-
Quality: 91/100 | Created: 2026-01-15
3+
Library: seaborn 0.13.2 | Python 3.14
4+
Quality: /100 | Updated: 2026-02-25
55
"""
66

77
import matplotlib.patches as mpatches
@@ -16,6 +16,7 @@
1616
sns.set_theme(style="whitegrid")
1717

1818
# Data: Software Development Project with Dependencies
19+
# All dependent tasks start at or after their predecessors end
1920
tasks_data = [
2021
# Requirements Phase
2122
{
@@ -49,51 +50,51 @@
4950
},
5051
{
5152
"task": "Database Design",
52-
"start": "2024-02-01",
53-
"end": "2024-02-12",
53+
"start": "2024-02-09",
54+
"end": "2024-02-20",
5455
"group": "Design",
5556
"depends_on": ["System Architecture"],
5657
},
5758
{
5859
"task": "UI/UX Design",
59-
"start": "2024-02-05",
60-
"end": "2024-02-18",
60+
"start": "2024-02-09",
61+
"end": "2024-02-22",
6162
"group": "Design",
6263
"depends_on": ["System Architecture"],
6364
},
6465
{
6566
"task": "Design Review",
66-
"start": "2024-02-19",
67-
"end": "2024-02-23",
67+
"start": "2024-02-23",
68+
"end": "2024-02-28",
6869
"group": "Design",
6970
"depends_on": ["Database Design", "UI/UX Design"],
7071
},
7172
# Development Phase
7273
{
7374
"task": "Backend Core",
74-
"start": "2024-02-26",
75+
"start": "2024-02-29",
7576
"end": "2024-03-18",
7677
"group": "Development",
7778
"depends_on": ["Design Review"],
7879
},
7980
{
8081
"task": "API Development",
81-
"start": "2024-03-04",
82-
"end": "2024-03-22",
82+
"start": "2024-03-19",
83+
"end": "2024-04-05",
8384
"group": "Development",
8485
"depends_on": ["Backend Core"],
8586
},
8687
{
8788
"task": "Frontend Components",
88-
"start": "2024-03-11",
89-
"end": "2024-03-29",
89+
"start": "2024-04-06",
90+
"end": "2024-04-22",
9091
"group": "Development",
9192
"depends_on": ["UI/UX Design", "API Development"],
9293
},
9394
{
9495
"task": "Integration",
95-
"start": "2024-04-01",
96-
"end": "2024-04-12",
96+
"start": "2024-04-23",
97+
"end": "2024-05-06",
9798
"group": "Development",
9899
"depends_on": ["API Development", "Frontend Components"],
99100
},
@@ -107,19 +108,19 @@
107108
},
108109
{
109110
"task": "Integration Testing",
110-
"start": "2024-04-08",
111-
"end": "2024-04-19",
111+
"start": "2024-05-07",
112+
"end": "2024-05-17",
112113
"group": "Testing",
113114
"depends_on": ["Integration", "Unit Testing"],
114115
},
115116
{
116117
"task": "UAT",
117-
"start": "2024-04-22",
118-
"end": "2024-05-03",
118+
"start": "2024-05-20",
119+
"end": "2024-05-31",
119120
"group": "Testing",
120121
"depends_on": ["Integration Testing"],
121122
},
122-
{"task": "Bug Fixes", "start": "2024-05-06", "end": "2024-05-17", "group": "Testing", "depends_on": ["UAT"]},
123+
{"task": "Bug Fixes", "start": "2024-06-03", "end": "2024-06-14", "group": "Testing", "depends_on": ["UAT"]},
123124
]
124125

125126
df = pd.DataFrame(tasks_data)
@@ -155,10 +156,8 @@
155156
fig, ax = plt.subplots(figsize=(16, 9))
156157

157158
# Create data for seaborn lineplot (bars as thick lines)
158-
# This uses seaborn's lineplot to draw horizontal bars as line segments
159159
line_data = []
160160
for _, row in df.iterrows():
161-
# Create start and end points for each task bar
162161
line_data.append(
163162
{"x": row["start_num"], "y": row["y_pos"], "task": row["task"], "group": row["group"], "point": "start"}
164163
)
@@ -193,7 +192,7 @@
193192

194193
ax.plot([group_start, group_end], [y, y], color=color, linewidth=10, alpha=0.4, solid_capstyle="round")
195194

196-
# Draw dependency arrows
195+
# Draw dependency arrows from right edge of predecessor to left edge of successor
197196
for _, row in df.iterrows():
198197
if row["depends_on"]:
199198
end_y = task_to_y[row["task"]]
@@ -230,9 +229,15 @@
230229
all_y.append(task_to_y[task])
231230

232231
ax.set_yticks(all_y)
233-
ax.set_yticklabels(all_labels, fontsize=12)
232+
ax.set_yticklabels(all_labels, fontsize=13)
234233
ax.invert_yaxis()
235234

235+
# Bold group labels for hierarchy emphasis
236+
for label in ax.get_yticklabels():
237+
if label.get_text().startswith("▪"):
238+
label.set_fontweight("bold")
239+
label.set_fontsize(14)
240+
236241
# X-axis formatting (dates)
237242
max_day = int(df["end_num"].max()) + 7
238243
date_ticks = np.arange(0, max_day, 14)

plots/gantt-dependencies/metadata/seaborn.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
library: seaborn
22
specification_id: gantt-dependencies
33
created: '2026-01-15T21:03:35Z'
4-
updated: '2026-01-15T21:06:24Z'
5-
generated_by: claude-opus-4-5-20251101
4+
updated: '2026-02-25T14:40:00Z'
5+
generated_by: claude-opus-4-6
66
workflow_run: 21046151686
77
issue: 3830
8-
python_version: 3.13.11
8+
python_version: '3.14'
99
library_version: 0.13.2
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/gantt-dependencies/seaborn/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/gantt-dependencies/seaborn/plot_thumb.png
1212
preview_html: null
13-
quality_score: 91
13+
quality_score: null
1414
review:
1515
strengths:
1616
- Excellent hierarchical organization with group headers and indented task names

plots/gantt-dependencies/specification.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ A Gantt chart that visualizes project schedules with task dependencies and group
2323

2424
## Notes
2525

26-
- Draw dependency arrows/connectors from the end of predecessor tasks to the start of successor tasks
26+
- Draw dependency arrows from the right edge (end date) of each predecessor bar to the left edge (start date) of the successor bar
2727
- Use different visual styles for dependency types (finish-to-start is most common)
2828
- Group headers should show aggregate timeline spanning from earliest to latest task in the group
2929
- Consider indentation or color coding to distinguish groups from individual tasks
3030
- Arrows should avoid overlapping task bars where possible
3131
- Include a legend explaining dependency line styles if multiple types are used
32+
- Dependent tasks must be scheduled to start at or after the end of their predecessor — never before
3233
- Vertical alignment should clearly show task hierarchy (groups above their child tasks)

plots/gantt-dependencies/specification.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Gantt Chart with Dependencies
66

77
# Specification tracking
88
created: 2026-01-15T20:43:22Z
9-
updated: 2026-01-15T20:43:22Z
9+
updated: 2026-02-25T12:00:00Z
1010
issue: 3830
1111
suggested: Eifi1
1212

@@ -27,3 +27,5 @@ tags:
2727
- grouped
2828
- hierarchical
2929
- annotated
30+
- temporal
31+
- dependencies

0 commit comments

Comments
 (0)