-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewchart copy.py
More file actions
97 lines (80 loc) · 2.76 KB
/
newchart copy.py
File metadata and controls
97 lines (80 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# !pip install arabic-reshaper python-bidi --quiet
import matplotlib.pyplot as plt
import numpy as np
import arabic_reshaper
from bidi.algorithm import get_display
import pandas as pd
# Fix Arabic function
def fix_ar(text):
return get_display(arabic_reshaper.reshape(text))
# Data
names = [
"Habiba Yousri", "Hadeer Ramadan", "آمنة أحمد", "إبراهيم ياسر",
"Omnia Ibrahim", "مهند محمود", "كيرلس ثروت", "عبدالرحمن أحمد",
"Azad Mohamed", "أحمد خالد", "إياد أحمد", "Sara Darwish", "عمر احمد",
"كنزي عادل", "رقيه", "محمد زناتي", "أحمد ياسر", "Mariam Sayed",
"Bishoy Ehab", "صفا أحمد", "مؤمن", "Nouran Ahmed"
]
old = [
1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0
]
tasks_labels = ["الشرح", "تجهيز السيشنز", "البروجكتات", "المتابعة على النيو", "حاجة تانية"]
tasks = [
[1,1,0,1,0],
[0,0,0,1,0],
[0,1,1,1,1],
[1,0,1,0,0],
[1,0,1,0,0],
[1,0,0,0,1],
[1,0,0,0,0],
[1,1,0,0,0],
[1,1,1,0,0],
[1,1,1,0,0],
[1,1,1,1,0],
[0,1,0,0,1],
[0,0,0,1,0],
[1,0,0,0,0],
[1,1,1,0,0],
[0,0,1,0,0],
[0,0,0,0,1],
[0,1,0,1,0],
[0,1,1,1,0],
[0,1,1,1,0],
[1,0,0,0,1],
[1,1,0,0,0],
]
tasks = np.array(tasks)
# Create a DataFrame
df = pd.DataFrame(tasks, columns=tasks_labels)
df.insert(0, "Old", ["نعم" if o else "لا" for o in old])
df.insert(0, "Name", names)
# Show summary of what each person can help in
print("🧾 قائمة المساعدين ومهامهم:\n")
for i, row in df.iterrows():
skills = [t for t, val in row[tasks_labels].items() if val == 1]
skills_text = ", ".join(skills) if skills else "لا يوجد"
print(f"{row['Name']} ({'قديم' if row['Old']=='نعم' else 'جديد'}): {skills_text}")
# --- HEATMAP PART ---
plt.rcParams['font.family'] = 'DejaVu Sans'
# Fix Arabic for labels
x_labels = [fix_ar(t) for t in tasks_labels]
y_labels = [fix_ar(n) for n in names]
fig, ax = plt.subplots(figsize=(10, 8))
im = ax.imshow(tasks, cmap='YlGn', aspect='auto')
# Set ticks
ax.set_xticks(np.arange(len(x_labels)))
ax.set_xticklabels(x_labels)
ax.set_yticks(np.arange(len(y_labels)))
ax.set_yticklabels(y_labels)
# Rotate X labels
plt.setp(ax.get_xticklabels(), rotation=30, ha="right", rotation_mode="anchor")
# Add colorbar
cbar = ax.figure.colorbar(im, ax=ax)
cbar.ax.set_ylabel(fix_ar("يقدر يساعد (1)"), rotation=-90, va="bottom")
# Add "Old" indicator
for i, is_old in enumerate(old):
color = 'green' if is_old else 'red'
ax.text(-0.5, i, "●", color=color, fontsize=12, ha='right', va='center')
ax.set_title(fix_ar("خريطة Heatmap للـ old"), pad=20)
plt.tight_layout()
plt.savefig("new new.png")