{
  "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# Centered colormaps\n\n\nxarray's automatic colormaps choice\n\n\n"
      ]
    },
    {
      "outputs": [],
      "execution_count": null,
      "source": [
        "import xarray as xr\nimport matplotlib.pyplot as plt\n\n# Load the data\nds = xr.tutorial.load_dataset('air_temperature')\nair = ds.air.isel(time=0)\n\nf, ((ax1, ax2), (ax3, ax4))  = plt.subplots(2, 2, figsize=(8, 6))\n\n# The first plot (in kelvins) chooses \"viridis\" and uses the data's min/max\nair.plot(ax=ax1, cbar_kwargs={'label':'K'})\nax1.set_title('Kelvins: default')\nax2.set_xlabel('')\n\n# The second plot (in celsius) now chooses \"BuRd\" and centers min/max around 0\nairc = air - 273.15\nairc.plot(ax=ax2, cbar_kwargs={'label':'\u00b0C'})\nax2.set_title('Celsius: default')\nax2.set_xlabel('')\nax2.set_ylabel('')\n\n# The center doesn't have to be 0\nair.plot(ax=ax3, center=273.15, cbar_kwargs={'label':'K'})\nax3.set_title('Kelvins: center=273.15')\n\n# Or it can be ignored\nairc.plot(ax=ax4, center=False, cbar_kwargs={'label':'\u00b0C'})\nax4.set_title('Celsius: center=False')\nax4.set_ylabel('')\n\n# Mke it nice\nplt.tight_layout()\nplt.show()"
      ],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    }
  ],
  "nbformat_minor": 0
}