-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotter.py
54 lines (36 loc) · 1.03 KB
/
plotter.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
import json #CodeForcesGraphPlotter
import matplotlib.pyplot as plt
import requests
import string
def makegraph():
userid=input()
txt="https://codeforces.com/api/user.rating?handle=namitaarya2002"
url=txt.replace("namitaarya2002",userid)
f = requests.get(url)
data=f.json()
if data["status"] != "OK":
print("Incorrect Username")
else:
ls1=[]
ls2=[]
ls3=[]
for i in data["result"]:
ls1.append(i["contestId"])
for i in data["result"]:
ls2.append(i["oldRating"])
for i in data["result"]:
ls3.append(i["newRating"])
# plt.scatter(ls3,ls1)
plt.plot(ls3,ls1,label=userid)
plt.xlabel("RANK")
plt.ylabel("CONTESTID")
plt.title(label="GRAPH(S)",fontsize=30, color="red")
plt.legend()
def showgraph():
plt.show()
print("Enter the number of users you wanna compare")
num=int(input())
for i in range(num):
print("Enter username")
makegraph()
showgraph()