imshow() and map projections

Using rasterio’s projection information for more accurate plots.

This example extends Parsing rasterio’s geocoordinates and plots the image in the original map projection instead of relying on pcolormesh and a map transformation.

import as ccrs
import matplotlib.pyplot as plt

import xarray as xr

# Read the data
url = ""
da = xr.open_rasterio(url)

# The data is in UTM projection. We have to set it manually until
# is implemented
crs = ccrs.UTM("18N")

# Plot on a map
ax = plt.subplot(projection=crs)
da.plot.imshow(ax=ax, rgb="band", transform=crs)
ax.coastlines("10m", color="r")

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

Gallery generated by Sphinx-Gallery