{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n\n============================\nimshow() and map projections\n============================\n\nUsing rasterio's projection information for more accurate plots.\n\nThis example extends `recipes.rasterio` and plots the image in the\noriginal map projection instead of relying on pcolormesh and a map\ntransformation.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import cartopy.crs as ccrs\nimport matplotlib.pyplot as plt\n\nimport xarray as xr\n\n# Read the data\nurl = \"https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif\"\nda = xr.open_rasterio(url)\n\n# The data is in UTM projection. We have to set it manually until\n# https://github.com/SciTools/cartopy/issues/813 is implemented\ncrs = ccrs.UTM(\"18N\")\n\n# Plot on a map\nax = plt.subplot(projection=crs)\nda.plot.imshow(ax=ax, rgb=\"band\", transform=crs)\nax.coastlines(\"10m\", color=\"r\")\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}