from matplotlib.pyplot import plot, show
nyc_temp_2000 = [31.3, 37.3, 47.2, 51.0, 63.5, 71.3, 72.3, 72.7, 66.0, 57.0, 45.3, 31.1]
nyc_temp_2006 = [40.9, 35.7, 43.1, 55.7, 63.1, 71.0, 77.9, 75.8, 66.6, 56.2, 51.9, 43.6]
nyc_temp_2012 = [37.3, 40.9, 50.9, 54.8, 65.1, 71.0, 78.8, 76.7, 68.8, 58.0, 43.9, 41.5]
months = range(1,13)
plot(months, nyc_temp_2000, months, nyc_temp_2006, months, nyc_temp_2012) #plot(x1,y1,x2,y2,x3,y3)
show()
from matplotlib.pyplot import plot, show
from pylab import legend #legend() 함수
nyc_temp_2000 = [31.3, 37.3, 47.2, 51.0, 63.5, 71.3, 72.3, 72.7, 66.0, 57.0, 45.3, 31.1]
nyc_temp_2006 = [40.9, 35.7, 43.1, 55.7, 63.1, 71.0, 77.9, 75.8, 66.6, 56.2, 51.9, 43.6]
nyc_temp_2012 = [37.3, 40.9, 50.9, 54.8, 65.1, 71.0, 78.8, 76.7, 68.8, 58.0, 43.9, 41.5]
months = range(1,13)
plot(months, nyc_temp_2000, months, nyc_temp_2006, months, nyc_temp_2012)
legend([2000, 2006, 2012]) #범례 만들어주는 함수
show()
[참고] Doing Math With Python - 저자 : AMIT SAHA
'#Python #수학' 카테고리의 다른 글
#날씨 그래프 #Python (0) | 2018.11.06 |
---|---|
#그래프 그리기 #Matplotlib #Python (0) | 2018.11.06 |
#이차방정식(근의 공식)의 해 구하기 #Python (0) | 2018.11.06 |
#단위변환 (인치->미터), (마일->킬로미터) #Python (0) | 2018.11.02 |
#곱하기 테이블(구구단) #Python (0) | 2018.11.02 |