-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinear.py
33 lines (25 loc) · 917 Bytes
/
linear.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
import json
import matplotlib.pyplot as plt
from matplotlib.legend_handler import HandlerLine2D
import matplotlib.patheffects as path_effects
o = open("data.json")
data = json.load(o)
o.close()
templist = []
for items in data:
temp = items["Temperature"]
templist.append(temp)
daylist = []
for items in data:
day = items["Day"]
daylist.append(day)
fig, bx = plt.subplots()
line1, = bx.plot([24, 26, 24, 22, 23, 21, 22], marker='o', label='line 1')
bx.legend(handler_map={line1: HandlerLine2D(numpoints=1)})
plt.plot([24, 26, 24, 22, 23, 21, 22], linewidth=5, color='#8B3626',
path_effects=[path_effects.SimpleLineShadow(),path_effects.Normal()])
plt.plot(daylist,templist, color='#8B3626')
plt.title("TEMPERATURE GRAPH", color='#27408B',fontweight="bold")
plt.ylabel("TEMPERATURE °C",color='#27408B',fontweight="bold")
plt.xlabel("DAY", color='#27408B',fontweight="bold")
plt.show()