{
  "metadata": {
    "language_info": {
      "pygments_lexer": "ipython3",
      "version": "3.5.4",
      "name": "python",
      "nbconvert_exporter": "python",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python"
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3",
      "language": "python"
    }
  },
  "nbformat": 4,
  "cells": [
    {
      "outputs": [],
      "execution_count": null,
      "source": [
        "%matplotlib inline"
      ],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "metadata": {},
      "cell_type": "markdown",
      "source": [
        "\n# Multiple plots and map projections\n\n\nControl the map projection parameters on multiple axes\n\nThis example illustrates how to plot multiple maps and control their extent\nand aspect ratio.\n\nFor more details see `this discussion`_ on github.\n\n\n"
      ]
    },
    {
      "outputs": [],
      "execution_count": null,
      "source": [
        "import xarray as xr\nimport cartopy.crs as ccrs\nimport matplotlib.pyplot as plt\n\n# Load the data\nds = xr.tutorial.load_dataset('air_temperature')\nair = ds.air.isel(time=[0, 724]) - 273.15\n\n# This is the map projection we want to plot *onto*\nmap_proj = ccrs.LambertConformal(central_longitude=-95, central_latitude=45)\n\np = air.plot(transform=ccrs.PlateCarree(),  # the data's projection\n             col='time', col_wrap=1,  # multiplot settings\n             aspect=ds.dims['lon']/ds.dims['lat'],  # for a sensible figsize\n             subplot_kws={'projection': map_proj})  # the plot's projection\n\n# We have to set the map's options on all four axes\nfor ax in p.axes.flat:\n    ax.coastlines()\n    ax.set_extent([-160, -30, 5, 75])\n    # Without this aspect attributes the maps will look chaotic and the\n    # \"extent\" attribute above will be ignored\n    ax.set_aspect('equal', 'box-forced')\n\nplt.show()"
      ],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    }
  ],
  "nbformat_minor": 0
}