-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewchart.py
More file actions
83 lines (69 loc) · 2.23 KB
/
Copy pathnewchart.py
File metadata and controls
83 lines (69 loc) · 2.23 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
import matplotlib.pyplot as plt
import numpy as np
import arabic_reshaper
from bidi.algorithm import get_display
from matplotlib import font_manager
# Make sure matplotlib uses a font that can show Arabic
plt.rcParams['font.family'] = 'DejaVu Sans'
# Helper to fix Arabic text
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 = [
[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)
# Fix Arabic labels
x_labels = [fix_ar(t) for t in ["الشرح", "تجهيز السيشنز", "البروجكتات", "المتابعة على النيو", "حاجة تانية"]]
y_labels = [fix_ar(n) for n in names]
# Create the heatmap
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 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("file.png")