-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactogram.py
More file actions
27 lines (22 loc) · 925 Bytes
/
actogram.py
File metadata and controls
27 lines (22 loc) · 925 Bytes
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
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import os,xlrd
import numpy as np
#directory & column
data = xlrd.open_workbook('C:/Users/Qukoyk/Desktop/201611-12.xlsx')
table = data.sheet_by_index(0) #sheet of data
ncols = table.ncols #get the number of columns
#number of subplot
z = 1
#
for i in range(ncols): #circulation of bar plot
x = table.col_values(i) #data in columns
y = np.arange(len(x)) #set groups as lenth of x-tick
plt.subplot(ncols,1,z) #draw subplot(all subplot,draw in 1 column,this subplot)
plt.bar(y,x,color='k') #draw bar plot
plt.xticks(visible=False) #xticks invisible
plt.yticks(visible=False) #yticks invisible
plt.subplots_adjust(hspace=0) #no places between subplots
plt.ylim(0,50) #set limitation of y-tick to 50
z = z+1 #number of subplot +1 & into the next circulation
plt.show() #show the actogram, takes about 1 minute under Raspberry Pi 3B