[참고] Doing Math With Python - 저자 : AMIT SAHA


# Matplotlib (라이브러리) 는 파이썬 기본 내장된 라이브러리가 아님 설치 해야함


(1) Matplotlib 설치(Windows 경우)

  1. cmd 실행
  2. c:\>python -m pip install --upgrade pip    #pip 업그레이드
  3. c:\>pip install matplotlib    #설치
  4. (파이썬 실행 후) >>>import matplotlib
(2) Linux(우분투 경우) 파이썬3에 설치
$sudo apt-get update
$sudo apt-get -f install
$sudo apt-get install python3-pip
$sudo apt-get install --upgrade pip
$sudo pip3 install matplotlib


>>>x_number = [1,2,3]

>>>y_number = [2,4,6]

>>>from plylab import plot, show    #plot()과 show() 함수는 pylab 모듈에서 import. matplotlib 패키지의 일종

>>>plot(x_numbers, y_numbers)

>>>show()




 #연결 그래프 (x,y) 좌표 마킹하기

>>>plot(x_number, y_numbers, marker = 'o')   

>>>show()


#좌표(x,y)만 마킹하기

>>>plot(x_number, y_numbers, 'o')   

>>>show()


+ Recent posts