Cartopy

Pythonで地図にデータをマッピング、様々な投影方法で描画する

タカ

Cartopyで描画できる他の投影を試します。

公式で提供されている投影方法のリストはこちらから。

サンプルプログラム

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

fig = plt.figure(figsize=(12, 9))

projections_list = [
    "PlateCarree",
    "AlbersEqualArea",
    "AzimuthalEquidistant",
    "EquidistantConic",
    "LambertConformal",
    "LambertCylindrical",
    "Mercator",
    "Miller",
    "Mollweide",
    "Orthographic",
    "Robinson",
    "Sinusoidal",
    "Stereographic",
    "TransverseMercator",
    "InterruptedGoodeHomolosine",
    "RotatedPole",
    "OSGB",
    "EuroPP",
    "Geostationary",
    "NearsidePerspective",
    "EckertI",
    "EckertII",
    "EckertIII",
    "EckertIV",
    "EckertV",
    "EckertVI",
    "EqualEarth",
    "Gnomonic",
    "LambertAzimuthalEqualArea",
    "NorthPolarStereo",
    "OSNI",
    "SouthPolarStereo"
]


def add_subplot(i, projection):
    ax = fig.add_subplot(4, 8, i, projection=eval(
        'ccrs.' + projection)())
    ax.stock_img()
    ax.set_title(projection)


i = 1
for projection in projections_list:
    add_subplot(i, projection)
    i = i + 1

# UTM
fig = plt.figure(figsize=(12, 9))
nplots = 60
for i in range(0, nplots):
    ax = fig.add_subplot(1, nplots, i+1,
                         projection=ccrs.UTM(zone=i+1,
                                             southern_hemisphere=True))
    ax.coastlines(resolution='110m')
    ax.gridlines()

plt.show()
実行結果
実行結果(UTM)

PlateCarreeの例

fig = plt.figure(figsize=(12,9))
ax = fig.add_subplot(1,1,1, projection=ccrs.PlateCarree()) #ここで投影方法を設定
ax.stock_img()
ax.set_title('PlateCarree')
plt.show()