import matplotlib.pyplot as plt
plt.rcParams['font.family'] ='Malgun Gothic'
import matplotlib
matplotlib.rcParams['axes.unicode_minus'] = False
f = open("data.txt", 'r')
mes = []
cnt = 0
bigData = []
while True:
line = f.readline()
fit = line[0:-1].split('\t')
for i in range(len(fit)):
# add more here
if fit == ':':
fit[cnt:] = list(map(int, fit))
else:
cnt = cnt + 1
if not line: break
# print(fit)
data = {}
# s = data[fit[0]]
data[fit[0]] = fit[1:]
pp = []
for i in range(4):
# print(list(data.values())[0][i],end=' ')
vvv = list(data.values())[0][i]# 0 ~ 3
pp.append(vvv)
# plt.plot(vvv)
# plt.plot([2023,2022,2021,2020],pp)
bigData.append(pp)
print(bigData)
for i in range(len(bigData)):
for j in range(len(bigData[i])):
bigData[i][j] = int(bigData[i][j])
for i in range(len(bigData)):
plt.plot([2023,2022,2021,2020],bigData[i],label=fit[1:])
plt.legend()
plt.show()
top of page
기능을 테스트하려면 라이브 사이트로 이동하세요.
고현
2023년 11월 11일
20231111
20231111
댓글 0개
좋아요
댓글(0)
bottom of page