하고재비

[python]꺽은선 그래프 본문

Python

[python]꺽은선 그래프

DeadDE 2017. 12. 1. 14:03
import matplotlib.pyplot as plt
from matplotlib import font_manager, rc

font_name = font_manager.FontProperties(fname="c:/Windows/Fonts/malgun.ttf").get_name()
rc('font', family=font_name)

temp = [29, 29, 28, 30, 31, 31, 32]
temp_min = min(temp)
temp_max = max(temp)
temp_sum = sum(temp)
temp_avg = sum(temp) / len(temp)
print(temp_min)
print(temp_max)
print(temp_sum)
print(temp_avg)

x = [1, 2, 3, 4, 5, 6, 7]
day = ['월', '화', '수', '목', '금', '토', '일']
plt.suptitle('이번 주 부산의 최고 낮 기온')
plt.plot(x, temp, c='r', lw=4)
plt.xticks(x, day, rotation='vertical')
plt.xlabel('요일')
plt.ylabel('기온')

plt.show()


'Python' 카테고리의 다른 글

[python] list 선언  (0) 2017.12.01
[python] 디렉토리에 특정파일 찾기  (0) 2017.12.01
[Python]객체  (0) 2017.11.10
[Python] Dict 총정리  (0) 2017.10.23
[Python] List 총정리  (0) 2017.10.23
Comments