matplotlib으로 만든 그림 사이즈를 어떻게 바꾸나요?
조회수 7823회
1 답변
-
이미 이미지 파일이 만들어져 있다면 다음과 같은 방법으로 캔버스 크기를 바꿀 수 있습니다.
import matplotlib.pyplot fig = matplotlib.pyplot.gcf() #현재 figure에 불러오기 fig.set_size_inches(18.5, 10.5) #크기 바꾸기(inch 단위) fig.savefig('test2png.png', dpi=100) #현재 figure 저장하기
set_size_inches(w, h, forward=False)는 inch단위로 figure의 크기를 바꿔줍니다.
forward=True
로 설정할 경우에는 캔버스 사이즈가 자동으로 업데이트 됩니다(사용 중인 gui window에서 바로 반영 됨)
댓글 입력