NCL_maponly_1.pyΒΆ

This script illustrates the following concepts:
  • Drawing a cylindrical equidistant map using Cartopy

  • Adding Cartopy land feature to map

  • Adding longitude and latitude tick marks

  • Adding major and minor tick marks

See following URLs to see the reproduces NCL plot & script:

Import packages:

import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import numpy as np

import geocat.viz.util as gvutil

Plot:

# Generate axes using Cartopy
ax = plt.axes(projection=ccrs.PlateCarree())

# Draw land
ax.add_feature(cfeature.LAND, color='silver')

# Use geocat.viz.util convenience function to set axes tick values
gvutil.set_axes_limits_and_ticks(ax,
                                 xticks=np.linspace(-180, 180, 13),
                                 yticks=np.linspace(-90, 90, 7))

# Use geocat.viz.util convenience function to make lat/lon tick labels
gvutil.add_lat_lon_ticklabels(ax)

# Use geocat.viz.util convenience function to add major and minor tick marks
gvutil.add_major_minor_ticks(ax)

# Show plot
plt.show()
NCL maponly 1

Total running time of the script: ( 0 minutes 0.160 seconds)

Gallery generated by Sphinx-Gallery