본문 바로가기

시각화/Matplotlib

Matplotlib - plt : xlim, ylim

반응형

https://steadiness-193.tistory.com/151

 

Matplotlib - 그래프 꾸미기 : marker, markerfacecolor, markersize, color, linewidth, linestyle

https://steadiness-193.tistory.com/150 Matplotlib - plt : xticks, yticks https://steadiness-193.tistory.com/149 Matplotlib - 선그래프, x축 라벨, y축 라벨, 그래프 제목, 범례 데이터 불러오기 서울에서..

steadiness-193.tistory.com

위 포스팅에서 만든 그래프를 이용한다.

 

 

 

기존 그래프

 

 

 

xlim

x축의 최솟값과 최댓값을 설정한다.

plt.xlim([최솟값, 최댓값])

 

 

 

 

1970부터 데이터가 있으니 축소된 것처럼 보이게 된다.

 

 

 

 

 

ylim

y축의 최솟값과 최댓값을 설정한다.

plt.ylim([최솟값, 최댓값])

 

 

 

 

 

 

 

 

ylim의 최솟값을 데이터 값의 최솟값보다 더 크게,

 

ylim의 최댓값을 데이터 값의 최댓값보다 더 작게

 

설정하면

 

 

데이터의 최솟값 : 100000

데이터의 최댓값 : 600000

 

ylim의 최솟값 : 200000

ylim의 최댓값 : 500000

 

이렇게 기존 그래프가 잘려서 나오게 된다.

 

 

 

반응형