Recent Posts
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Today
Total
관리 메뉴

코드민수

[Python] plt.savefig() 시 생기는 여백 제거 방법 본문

[Python]/코드

[Python] plt.savefig() 시 생기는 여백 제거 방법

코드민수 2023. 5. 10. 19:58
BIG
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

plt.figure(figsize=(10, 10))

map = Basemap(projection='merc', lat_0=37.35, lon_0=126.58, resolution='h',
              urcrnrlat=44, llcrnrlat=32, llcrnrlon=121.5, urcrnrlon=132.5)

map.drawcoastlines()
map.drawcountries()
map.drawmapboundary()

plt.savefig('map.png', bbox_inches='tight')

plt.savefig() 에 bbox_inches='tight'를 추가하면 됩니다.

 

저장된 이미지

 

LIST