{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Rotated Pole Mapping\n\nThis example uses several visualisation methods to achieve an array of\ndiffering images, including:\n\n * Visualisation of point based data\n * Contouring of point based data\n * Block plot of contiguous bounded data\n * Non native projection and a Natural Earth shaded relief image underlay\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import cartopy.crs as ccrs\nimport matplotlib.pyplot as plt\n\nimport iris\nimport iris.analysis.cartography\nimport iris.plot as iplt\nimport iris.quickplot as qplt\n\n\ndef main():\n    # Load some test data.\n    fname = iris.sample_data_path(\"rotated_pole.nc\")\n    air_pressure = iris.load_cube(fname)\n\n    # Plot #1: Point plot showing data values & a colorbar\n    plt.figure()\n    points = qplt.points(air_pressure, c=air_pressure.data)\n    cb = plt.colorbar(points, orientation=\"horizontal\")\n    cb.set_label(air_pressure.units)\n    plt.gca().coastlines()\n    iplt.show()\n\n    # Plot #2: Contourf of the point based data\n    plt.figure()\n    qplt.contourf(air_pressure, 15)\n    plt.gca().coastlines()\n    iplt.show()\n\n    # Plot #3: Contourf overlayed by coloured point data\n    plt.figure()\n    qplt.contourf(air_pressure)\n    iplt.points(air_pressure, c=air_pressure.data)\n    plt.gca().coastlines()\n    iplt.show()\n\n    # For the purposes of this example, add some bounds to the latitude\n    # and longitude\n    air_pressure.coord(\"grid_latitude\").guess_bounds()\n    air_pressure.coord(\"grid_longitude\").guess_bounds()\n\n    # Plot #4: Block plot\n    plt.figure()\n    plt.axes(projection=ccrs.PlateCarree())\n    iplt.pcolormesh(air_pressure)\n    plt.gca().stock_img()\n    plt.gca().coastlines()\n    iplt.show()\n\n\nif __name__ == \"__main__\":\n    main()"
      ]
    }
  ],
  "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.10.8"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}