前回(その2)で作成した日本地図を少し修正します。
import geopandas as gpd
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import shutil
from PIL import Image
japan_resize = gpd.read_file("/home/yasube873/Python/weather/map/japan_map.shp", encoding='utf-8')
japan_resize = japan_resize[['N03_001','N03_002','N03_007','geometry']]
fig, ax = plt.subplots(figsize = (21,16))
plt.xlim(128, 149)
plt.ylim(30, 46)
plt.xticks([])
plt.yticks([])
plt.gca().spines['left'].set_visible(False)
plt.gca().spines['top'].set_visible(False)
plt.gca().spines['right'].set_visible(False)
plt.gca().spines['bottom'].set_visible(False)
japan_resize.plot(ax=ax, facecolor='white', edgecolor='black', linewidth=0.5)
plt.show()
fig.savefig("hokkaido-kyushu.png")
fig, ax = plt.subplots(figsize = (10,6.7))
plt.xlim(122, 132)
plt.ylim(23.5, 30.2)
plt.xticks([])
plt.yticks([])
plt.gca().spines['left'].set_visible(False)
plt.gca().spines['top'].set_visible(False)
japan_resize.plot(ax=ax, facecolor='white', edgecolor='black', linewidth=0.5)
plt.show()
fig.savefig("okinawa.png")
plt.xlim(122, 132)
plt.ylim(23.5, 30.2)
plt.xticks([])
plt.yticks([])
plt.gca().spines['left'].set_visible(False)
plt.gca().spines['top'].set_visible(False)
japan_resize.plot(ax=ax, facecolor='white', edgecolor='black', linewidth=0.5)
plt.show()
fig.savefig("okinawa.png")
fig, ax = plt.subplots(figsize = (0.5,1))
plt.xlim(142, 142.5)
plt.ylim(27, 28)
plt.xticks([])
plt.yticks([])
plt.gca().spines['right'].set_visible(False)
plt.gca().spines['bottom'].set_visible(False)
japan_resize.plot(ax=ax, facecolor='white', edgecolor='black', linewidth=0.5)
plt.show()
fig.savefig("ogasawara.png")
im1 = Image.open('/home/yasube873/Python/weather/map/hokkaido-kyushu.png')
im2 = Image.open('/home/yasube873/Python/weather/map/okinawa.png')
back_im = im1.copy()
back_im.paste(im2, (135, 110))
back_im.save('/home/yasube873/Python/weather/map/japan_resize.png')
im1 = Image.open('/home/yasube873/Python/weather/map/japan_resize.png')
im2 = Image.open('/home/yasube873/Python/weather/map/ogasawara.png')
back_im = im1.copy()
back_im.paste(im2, (1300, 1300))
back_im.save('/home/yasube873/Python/weather/map/japan_resize.png')
back_im.show()
公平性を保つことにします)
0 件のコメント:
コメントを投稿