-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgs2hbarw.py
62 lines (43 loc) · 1.17 KB
/
gs2hbarw.py
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
import gspread
import pandas as pd
import matplotlib.pyplot as plt
"""
Plot cumulative words per project from Google Sheet workbook as horizontal bar plot.
Must authorize access to Google Sheets and Google Drive first time.
This authorization is done only once.
Blaine Mooers and OU Board of Regents
OUHSC
2024 January 25
"""
# gc = gspread.oauth()
# sh = gc.open('wp-2024-25')
gc = gspread.service_account()
sh = gc.open('wp-ja-2024-25')
#print(sh.worksheet("min_day").get('H1:AE1'))
#print(sh.worksheet("min_day").get('H733:AE733'))
P = sh.worksheet("word_day").get('I1:AE1')
# Flatten list of lists into a list of strings of project names
projects = [
x
for xs in P
for x in xs
]
H = sh.worksheet("word_day").get('I733:AE733')
hours = [
x
for xs in H
for x in xs
]
# Convert the strings in our list into integers.
int_list = list(map(int, hours))
# plot y,x
plt.barh(projects, int_list)
# setting x-label
plt.xlabel("Words")
# setting y_label
plt.ylabel("Project Name")
plt.rcParams.update({'font.size': 10})
# If project name is long, shift the plot frame to the right.
plt.subplots_adjust(left=0.15)
#plt.savefig('gshbarw.png', dpi=100)
plt.show()