Taiwan¶
In [1]:
Copied!
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
# Set the latitudinal and longitudinal limits of the map.
minLat, maxLat = 21.75, 25.5
minLon, maxLon = 119.25, 122.5
# Create a figure and axes object.
fig = plt.figure(figsize=(8, 8))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
# Create a Basemap object with the specified projection and limits.
m = Basemap(
projection='cyl',
resolution='h',
llcrnrlat=minLat,
urcrnrlat=maxLat,
llcrnrlon=minLon,
urcrnrlon=maxLon,
ax=ax
)
# Draw the blue marble background.
m.bluemarble()
# Add the coastline and country boundaries.
m.drawcoastlines(color='k')
m.drawcountries(color='k')
# Add the parallels and meridians.
parallels = np.arange(21., 26.1, 1.)
meridians = np.arange(119., 123.1, 1.)
m.drawparallels(
parallels,
labels=[1, 0, 0, 0],
fontsize=14, linewidth=0.5
)
m.drawmeridians(
meridians,
labels=[0, 0, 0, 1],
fontsize=14,
linewidth=0.5
)
# Set the title of the plot.
plt.title('Map of Taiwan', fontsize=20)
# Save the figure and display it.
plt.show()
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
# Set the latitudinal and longitudinal limits of the map.
minLat, maxLat = 21.75, 25.5
minLon, maxLon = 119.25, 122.5
# Create a figure and axes object.
fig = plt.figure(figsize=(8, 8))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
# Create a Basemap object with the specified projection and limits.
m = Basemap(
projection='cyl',
resolution='h',
llcrnrlat=minLat,
urcrnrlat=maxLat,
llcrnrlon=minLon,
urcrnrlon=maxLon,
ax=ax
)
# Draw the blue marble background.
m.bluemarble()
# Add the coastline and country boundaries.
m.drawcoastlines(color='k')
m.drawcountries(color='k')
# Add the parallels and meridians.
parallels = np.arange(21., 26.1, 1.)
meridians = np.arange(119., 123.1, 1.)
m.drawparallels(
parallels,
labels=[1, 0, 0, 0],
fontsize=14, linewidth=0.5
)
m.drawmeridians(
meridians,
labels=[0, 0, 0, 1],
fontsize=14,
linewidth=0.5
)
# Set the title of the plot.
plt.title('Map of Taiwan', fontsize=20)
# Save the figure and display it.
plt.show()
In [ ]:
Copied!