-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathheatplot.py
32 lines (28 loc) · 960 Bytes
/
heatplot.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
import seaborn as sns
from pymongo import MongoClient
from PIL import Image
import sys
import os
def heatplot(username1, username2):
client = MongoClient('localhost', 27017)
db = client.test
users = db.users
query = users.find({"login":username1})
for item in query:
username1 = item["weekly_arr"]
query = users.find({"login":username2})
for item in query:
username2 = item["weekly_arr"]
data = [username1,username2]
ax = sns.heatmap(data)
ax.get_figure().savefig("./app/views/partials/temp.png")
i = Image.open("./app/views/partials/temp.png")
w,h = i.size
i.crop((80, 58, w-163, h-53)).save("./app/views/partials/output.png")
os.remove("./app/views/partials/temp.png")
plt.close()
print("Render Complete!!")
print(data)
#usernames = [sys.argv[1], sys.argv[2]]
#heatplot(usernames[0],usernames[1])
heatplot("war-turtle","DumbMachine")