오늘의 인기 글
최근 글
최근 댓글
Today
Total
05-19 08:40
관리 메뉴

우노

[Matplotlib] figure, subplot 차이 본문

Language/Python

[Matplotlib] figure, subplot 차이

운호(Noah) 2021. 6. 23. 13:58

matplotlib.pyplot.figure

  • reference

  • example

      import matplotlib.pyplot as plt
    
      # figure 크기 설정
      plt.figure(figsize=(15,7))
    
      # grid 설정
      plt.grid(True)
    
      # title 설정
      plt.title()
    
      # x, y축 라벨 설정
      plt.xlabel()
      plt.ylabel()
    
      # x, y축 범위 설정
      plt.xlim()
      plt.xlim()
    
      # x, y축 눈금 설정
      plt.xticks()
      plt.yticks()
    
      # 범례
      plt.legend()
    
      # 그리기
      plt.plot()
    
      # 보이기
      plt.show()

matplotlib.pyplot.subplot

  • reference

  • example

      import matplotlib.pyplot as plt
    
      # figure 크기 설정
      fig = plt.figure(figsize=(15,7))
      # subplot 추가
      ax = fig.add_subplot(111) 
    
      # grid 설정
      ax.grid(True)
    
      # title 설정
      ax.set_title()
    
      # x, y축 라벨 설정
      ax.set_xlabel()
      ax.set_ylabel()
    
      # x, y축 범위 설정
      ax.set_xlim()
      ax.set_ylim()
    
      # x, y축 눈금 설정
      ax.set_xticks()
      ax.set_yticks()
    
      # x, y축 눈금 라벨 설정
      ax.set_xticklabels()
      ax.set_yticklabels()
    
      # 범례
      ax.legend()
    
      # 그리기
      ax.plot()
    
      # 보이기
      plt.show()
Comments