{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Code to create the texture colormap.png"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from matplotlib import cm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib.colors import ListedColormap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAGHRFWHRUaXRsZQBibGFja2JvZHkgY29sb3JtYXAGka9xAAAAHnRFWHREZXNjcmlwdGlvbgBibGFja2JvZHkgY29sb3JtYXBECkn6AAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAIfSURBVHic7dZNcptAFIXRhux/KV5ENuRJ4jiWkMggKuupaIqf6T1noq7XNCBbg294+znP7WFoK1Y31h060rn4xCNfDp49PywWB87s3tj5iBPfZTj73mf+B0N32b/0yN9i77tsPP/sM4/cq/d76d137VV69+3O9rxL71md9zpyfuv9hpXvvXWv3ftb9y/DceN8b7/et+6P4/LaceNea+fHzv6Pzn49N8z357CV9Xx7/WyttXlrv6zvG/vf56flmbX5y2xaXtub1Xndv187+9eV/bK+XddnrbV2vyxnt8tyfft6zqa6/5hPdb+znv6W2edzfa3rP/8/L7/L7P25vnw8Zq3MOuvy+PbZWX+U2a+yLo8qP0MAIIUAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAv0DuxRqsRxmkVgAAAAASUVORK5CYII=\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>blackbody</strong> </div><div class=\"cmap\"><img alt=\"blackbody colormap\" title=\"blackbody\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAGHRFWHRUaXRsZQBibGFja2JvZHkgY29sb3JtYXAGka9xAAAAHnRFWHREZXNjcmlwdGlvbgBibGFja2JvZHkgY29sb3JtYXBECkn6AAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAIfSURBVHic7dZNcptAFIXRhux/KV5ENuRJ4jiWkMggKuupaIqf6T1noq7XNCBbg294+znP7WFoK1Y31h060rn4xCNfDp49PywWB87s3tj5iBPfZTj73mf+B0N32b/0yN9i77tsPP/sM4/cq/d76d137VV69+3O9rxL71md9zpyfuv9hpXvvXWv3ftb9y/DceN8b7/et+6P4/LaceNea+fHzv6Pzn49N8z357CV9Xx7/WyttXlrv6zvG/vf56flmbX5y2xaXtub1Xndv187+9eV/bK+XddnrbV2vyxnt8tyfft6zqa6/5hPdb+znv6W2edzfa3rP/8/L7/L7P25vnw8Zq3MOuvy+PbZWX+U2a+yLo8qP0MAIIUAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAgkAAAgkAAAgkAAAgEACAAACCQAACCQAACCQAACAQAIAAAIJAAAIJAAAIJAAAIBAAgAAAv0DuxRqsRxmkVgAAAAASUVORK5CYII=\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#adc1ffff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #adc1ffff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#ff3300ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #ff3300ff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.ListedColormap at 0x10f923c70>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bb_cmap = plt.imread('bb.png')\n",
    "new_cmap = ListedColormap(bb_cmap[0][::-1],name='blackbody')\n",
    "new_cmap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAHnRFWHRUaXRsZQBibGFja2JvZHlfZXh0cmEgY29sb3JtYXB312zaAAAAJHRFWHREZXNjcmlwdGlvbgBibGFja2JvZHlfZXh0cmEgY29sb3JtYXC9a4W1AAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAIzSURBVHic7dbBmpowAIXRIPN48/6P0c20nY4idCFUzRCEbu85m5hAgvi5+Lv392kqs/7teXyr5n2/fn1tb/Osfv365nN3nrXrHRrXSymlK5VvC+t23dZtTnftPbKn+/bhxX0vFzeOOvD9uiPfZ+9vtuP5redu/U6t/0O9vvVO9fmv9q59n8NnbLxL696tZ7za07y+8g6tva/W99xzqs+q1tfOWK6dTut71vbWe+p7+3r99HDGNM6f5nG6VmNr/Xo/ZGxc+zcO1X3V/Glt2DdfxlJKGS/Vtcv6eG3MSyllPD+vXc/V+HUbh3r+dT9jqNaGP/P4eRsvy/j7Np5/zvMf9zPOv+a1ZV6Ny+M+q7GUUuat5WMel2PHneORe5dxqub/c8bD3oe/JgCQQgAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACB/gL0OX6KLrQ7tgAAAABJRU5ErkJggg==\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>blackbody_extra</strong> </div><div class=\"cmap\"><img alt=\"blackbody_extra colormap\" title=\"blackbody_extra\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAHnRFWHRUaXRsZQBibGFja2JvZHlfZXh0cmEgY29sb3JtYXB312zaAAAAJHRFWHREZXNjcmlwdGlvbgBibGFja2JvZHlfZXh0cmEgY29sb3JtYXC9a4W1AAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAIzSURBVHic7dbBmpowAIXRIPN48/6P0c20nY4idCFUzRCEbu85m5hAgvi5+Lv392kqs/7teXyr5n2/fn1tb/Osfv365nN3nrXrHRrXSymlK5VvC+t23dZtTnftPbKn+/bhxX0vFzeOOvD9uiPfZ+9vtuP5redu/U6t/0O9vvVO9fmv9q59n8NnbLxL696tZ7za07y+8g6tva/W99xzqs+q1tfOWK6dTut71vbWe+p7+3r99HDGNM6f5nG6VmNr/Xo/ZGxc+zcO1X3V/Glt2DdfxlJKGS/Vtcv6eG3MSyllPD+vXc/V+HUbh3r+dT9jqNaGP/P4eRsvy/j7Np5/zvMf9zPOv+a1ZV6Ny+M+q7GUUuat5WMel2PHneORe5dxqub/c8bD3oe/JgCQQgAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACB/gL0OX6KLrQ7tgAAAABJRU5ErkJggg==\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#4c4cffff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #4c4cffff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#ff0d00ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #ff0d00ff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.ListedColormap at 0x10fa0c580>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "n_extra_over = 20\n",
    "n_extra_under = 30\n",
    "my_bb_cmap = np.zeros((bb_cmap.shape[1]+n_extra_over+n_extra_under,3))\n",
    "\n",
    "my_bb_cmap[n_extra_over:-n_extra_under] = bb_cmap[0]\n",
    "\n",
    "## handle the redder zone\n",
    "differ = ([1,0.05,0] - bb_cmap[0][0])[:,None]/n_extra_over*np.arange(1,n_extra_over+1)[::-1]\n",
    "differ = differ.T\n",
    "my_bb_cmap[:n_extra_over] = differ+bb_cmap[0][0]\n",
    "\n",
    "## handle the bluer zone\n",
    "differ = ([0.3,0.3,1] - bb_cmap[0][-1])[:,None]/n_extra_under*np.arange(1,n_extra_under+1)\n",
    "differ = differ.T\n",
    "my_bb_cmap[-n_extra_under:] = differ+bb_cmap[0][-1]\n",
    "\n",
    "\n",
    "newer_cmap = ListedColormap(my_bb_cmap[::-1],name='blackbody_extra')\n",
    "newer_cmap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib.colors import LinearSegmentedColormap\n",
    "buffer = 0.5\n",
    "minor = [(0.0, 0.0, 0.0),\n",
    "        (buffer, 0.0, 0.0),\n",
    "        (1-buffer, 0.0, 0.0),\n",
    "        (1.0,  1.0, 1.0)]\n",
    "major = [(0.0, 1.0, 1.0),\n",
    "        (buffer, 0.0, 0.0),\n",
    "        (1-buffer, 0.0, 0.0),\n",
    "        (1.0,  0.0, 0.0)]\n",
    "\n",
    "div_cmaps = []\n",
    "colors = ['red','green','blue']\n",
    "others = ['cyan','magenta','yellow']\n",
    "for color,other in zip(colors,others):\n",
    "    cdict = {color:major,**dict([(subcolor,minor) for subcolor in colors if subcolor !=color])}\n",
    "    div_cmaps += [LinearSegmentedColormap(color.title()+'Black'+other.title(),cdict)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAG3RFWHRUaXRsZQBSZWRCbGFja0N5YW4gY29sb3JtYXBGA6NYAAAAIXRFWHREZXNjcmlwdGlvbgBSZWRCbGFja0N5YW4gY29sb3JtYXDEmkndAAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAFWSURBVHic7dYxEoJAEADBBf//ZMRATCwxI9DpTrauuGPTWfaZfWbmPk+m+W1ux9z//P3Zve3tfPafX3k/y/Kc6/p5vr7fbt/vXTXtt9/+y/YfJwCgRAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACHoATRaCfUndpqEAAAAASUVORK5CYII=\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>RedBlackCyan</strong> </div><div class=\"cmap\"><img alt=\"RedBlackCyan colormap\" title=\"RedBlackCyan\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAG3RFWHRUaXRsZQBSZWRCbGFja0N5YW4gY29sb3JtYXBGA6NYAAAAIXRFWHREZXNjcmlwdGlvbgBSZWRCbGFja0N5YW4gY29sb3JtYXDEmkndAAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAFWSURBVHic7dYxEoJAEADBBf//ZMRATCwxI9DpTrauuGPTWfaZfWbmPk+m+W1ux9z//P3Zve3tfPafX3k/y/Kc6/p5vr7fbt/vXTXtt9/+y/YfJwCgRAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACHoATRaCfUndpqEAAAAASUVORK5CYII=\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#ff0000ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #ff0000ff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#00ffffff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00ffffff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.LinearSegmentedColormap at 0x10fa23d90>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "div_cmaps[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAIHRFWHRUaXRsZQBHcmVlbkJsYWNrTWFnZW50YSBjb2xvcm1hcEbY728AAAAmdEVYdERlc2NyaXB0aW9uAEdyZWVuQmxhY2tNYWdlbnRhIGNvbG9ybWFwfWsIZwAAADB0RVh0QXV0aG9yAE1hdHBsb3RsaWIgdjMuNS4xLCBodHRwczovL21hdHBsb3RsaWIub3Jn97fOzwAAADJ0RVh0U29mdHdhcmUATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmfZEVHoAAABV0lEQVR4nO3WMXLCQBBFwS+4/5GxnJiEMhAR2K87mVLtriZ9x86d27avzTTfztvPPP/5+2f3bg/fz/7zR94fO7Ztl11+nffz664v731q2m+//Z/cDwDkCAAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQd/PBoJ9eu5mSAAAAABJRU5ErkJggg==\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>GreenBlackMagenta</strong> </div><div class=\"cmap\"><img alt=\"GreenBlackMagenta colormap\" title=\"GreenBlackMagenta\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAIHRFWHRUaXRsZQBHcmVlbkJsYWNrTWFnZW50YSBjb2xvcm1hcEbY728AAAAmdEVYdERlc2NyaXB0aW9uAEdyZWVuQmxhY2tNYWdlbnRhIGNvbG9ybWFwfWsIZwAAADB0RVh0QXV0aG9yAE1hdHBsb3RsaWIgdjMuNS4xLCBodHRwczovL21hdHBsb3RsaWIub3Jn97fOzwAAADJ0RVh0U29mdHdhcmUATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmfZEVHoAAABV0lEQVR4nO3WMXLCQBBFwS+4/5GxnJiEMhAR2K87mVLtriZ9x86d27avzTTfztvPPP/5+2f3bg/fz/7zR94fO7Ztl11+nffz664v731q2m+//Z/cDwDkCAAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQd/PBoJ9eu5mSAAAAABJRU5ErkJggg==\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#00ff00ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00ff00ff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#ff00ffff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #ff00ffff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.LinearSegmentedColormap at 0x10fa23d00>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "div_cmaps[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAHnRFWHRUaXRsZQBCbHVlQmxhY2tZZWxsb3cgY29sb3JtYXC37WuuAAAAJHRFWHREZXNjcmlwdGlvbgBCbHVlQmxhY2tZZWxsb3cgY29sb3JtYXB9UYLBAAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAFVSURBVHic7dYxEoJAEADBRf7/ZMRATSzRiECnO9m64o5NZ5nZ95mZmeuY5ve5Peb+5++P7m0v56P//Mb7ZbmfLpf38/l9XT/fO2vab7/9J+4fACBHAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIugFRBYJ9MSG2sQAAAABJRU5ErkJggg==\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>BlueBlackYellow</strong> </div><div class=\"cmap\"><img alt=\"BlueBlackYellow colormap\" title=\"BlueBlackYellow\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAHnRFWHRUaXRsZQBCbHVlQmxhY2tZZWxsb3cgY29sb3JtYXC37WuuAAAAJHRFWHREZXNjcmlwdGlvbgBCbHVlQmxhY2tZZWxsb3cgY29sb3JtYXB9UYLBAAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAFVSURBVHic7dYxEoJAEADBRf7/ZMRATSzRiECnO9m64o5NZ5nZ95mZmeuY5ve5Peb+5++P7m0v56P//Mb7ZbmfLpf38/l9XT/fO2vab7/9J+4fACBHAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIugFRBYJ9MSG2sQAAAABJRU5ErkJggg==\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#0000ffff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #0000ffff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#ffff00ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #ffff00ff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.LinearSegmentedColormap at 0x10fa23d30>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "div_cmaps[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib.colors import ListedColormap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib.colors import LinearSegmentedColormap\n",
    "minor = [(0.0,  0.0, 0.0),\n",
    "        (0.7, 0.0, 0.0),\n",
    "        (1.0,  .5, 0.0)]\n",
    "major = [(0.0,  0.0, 0.0),\n",
    "        (0.1, 0.3, 0.3),\n",
    "        (1.0,  1.0, 0.0)]\n",
    "\n",
    "cmaps = []\n",
    "colors = ['red','green','blue']\n",
    "for color in colors:\n",
    "    cdict = {color:major,**dict([(subcolor,minor) for subcolor in colors if subcolor !=color])}\n",
    "    cmaps += [LinearSegmentedColormap('Blk'+color.title(),cdict)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAFXRFWHRUaXRsZQBCbGtSZWQgY29sb3JtYXDHwSWsAAAAG3RFWHREZXNjcmlwdGlvbgBCbGtSZWQgY29sb3JtYXCOVj1IAAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAFtSURBVHic7dY7DsIwEEDBTeD+V4YCUoCEKPgI8maalRLLsau8ZWZOMzOHufjUXK/z+OH321yezHnx/bv2+dZ36vv867m/9Z29nufv77Wut3O5rnjw/H79PHh+v35e3OfXzrPXe737PNv/EgAIEQAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAgs42SQN8mvu9NAAAAABJRU5ErkJggg==\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>BlkRed</strong> </div><div class=\"cmap\"><img alt=\"BlkRed colormap\" title=\"BlkRed\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAFXRFWHRUaXRsZQBCbGtSZWQgY29sb3JtYXDHwSWsAAAAG3RFWHREZXNjcmlwdGlvbgBCbGtSZWQgY29sb3JtYXCOVj1IAAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmf3t87PAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9kRUegAAAFtSURBVHic7dY7DsIwEEDBTeD+V4YCUoCEKPgI8maalRLLsau8ZWZOMzOHufjUXK/z+OH321yezHnx/bv2+dZ36vv867m/9Z29nufv77Wut3O5rnjw/H79PHh+v35e3OfXzrPXe737PNv/EgAIEQAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAgs42SQN8mvu9NAAAAABJRU5ErkJggg==\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#000000ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #000000ff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#ff8080ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #ff8080ff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.LinearSegmentedColormap at 0x10fa0cc10>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cmaps[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAF3RFWHRUaXRsZQBCbGtHcmVlbiBjb2xvcm1hcAvofxQAAAAddEVYdERlc2NyaXB0aW9uAEJsa0dyZWVuIGNvbG9ybWFwIpaYPQAAADB0RVh0QXV0aG9yAE1hdHBsb3RsaWIgdjMuNS4xLCBodHRwczovL21hdHBsb3RsaWIub3Jn97fOzwAAADJ0RVh0U29mdHdhcmUATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmfZEVHoAAABbElEQVR4nO3WOQ4CMRAAwfHC/78MARCAhAg4BHRVMpLXsr1Zr5k5zMzMbuatczvP/Zu/X+Z6MOfJ768651P31M/51Xd/6p5/fc+P/9e2tqu51mnDNnfWb/fPnfXb/fPkOd/2nn/9r5e/BwDIEQAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAgo41yQN8tOHBYAAAAABJRU5ErkJggg==\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>BlkGreen</strong> </div><div class=\"cmap\"><img alt=\"BlkGreen colormap\" title=\"BlkGreen\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAF3RFWHRUaXRsZQBCbGtHcmVlbiBjb2xvcm1hcAvofxQAAAAddEVYdERlc2NyaXB0aW9uAEJsa0dyZWVuIGNvbG9ybWFwIpaYPQAAADB0RVh0QXV0aG9yAE1hdHBsb3RsaWIgdjMuNS4xLCBodHRwczovL21hdHBsb3RsaWIub3Jn97fOzwAAADJ0RVh0U29mdHdhcmUATWF0cGxvdGxpYiB2My41LjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmfZEVHoAAABbElEQVR4nO3WOQ4CMRAAwfHC/78MARCAhAg4BHRVMpLXsr1Zr5k5zMzMbuatczvP/Zu/X+Z6MOfJ768651P31M/51Xd/6p5/fc+P/9e2tqu51mnDNnfWb/fPnfXb/fPkOd/2nn/9r5e/BwDIEQAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAgo41yQN8tOHBYAAAAABJRU5ErkJggg==\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#000000ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #000000ff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#80ff80ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #80ff80ff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.LinearSegmentedColormap at 0x10fa0c880>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cmaps[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAFnRFWHRUaXRsZQBCbGtCbHVlIGNvbG9ybWFwruB3wwAAABx0RVh0RGVzY3JpcHRpb24AQmxrQmx1ZSBjb2xvcm1hcAnOxroAAAAwdEVYdEF1dGhvcgBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ/e3zs8AAAAydEVYdFNvZnR3YXJlAE1hdHBsb3RsaWIgdjMuNS4xLCBodHRwczovL21hdHBsb3RsaWIub3Jn2RFR6AAAAWtJREFUeJzt1jkOwkAQAMFZw/+/DAkEICEkLgFdlYx8aLzOes3MYWZmZjfvndtp7t/8/DzXnTlPPn/Vnk99p77nV8/9qe/863l++7+2bV3Mtc7Xc+P+9fv39lzue3zPt53nX//rxecZACBHAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIOgI1SQN88qKy/AAAAABJRU5ErkJggg==\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>BlkBlue</strong> </div><div class=\"cmap\"><img alt=\"BlkBlue colormap\" title=\"BlkBlue\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAFnRFWHRUaXRsZQBCbGtCbHVlIGNvbG9ybWFwruB3wwAAABx0RVh0RGVzY3JpcHRpb24AQmxrQmx1ZSBjb2xvcm1hcAnOxroAAAAwdEVYdEF1dGhvcgBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ/e3zs8AAAAydEVYdFNvZnR3YXJlAE1hdHBsb3RsaWIgdjMuNS4xLCBodHRwczovL21hdHBsb3RsaWIub3Jn2RFR6AAAAWtJREFUeJzt1jkOwkAQAMFZw/+/DAkEICEkLgFdlYx8aLzOes3MYWZmZjfvndtp7t/8/DzXnTlPPn/Vnk99p77nV8/9qe/863l++7+2bV3Mtc7Xc+P+9fv39lzue3zPt53nX//rxecZACBHAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIEgAAECQAACBIAABAkAAAgCABAABBAgAAggQAAAQJAAAIOgI1SQN88qKy/AAAAABJRU5ErkJggg==\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#000000ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #000000ff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#8080ffff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #8080ffff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.LinearSegmentedColormap at 0x10fa0cbe0>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cmaps[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAHHRFWHRUaXRsZQBjbW9jZWFuX0FsZ2FlIGNvbG9ybWFwAdDCRAAAACJ0RVh0RGVzY3JpcHRpb24AY21vY2Vhbl9BbGdhZSBjb2xvcm1hcJyALAEAAAAwdEVYdEF1dGhvcgBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ/e3zs8AAAAydEVYdFNvZnR3YXJlAE1hdHBsb3RsaWIgdjMuNS4xLCBodHRwczovL21hdHBsb3RsaWIub3Jn2RFR6AAAAZdJREFUeJzt1rtSg1AUQNGj//9xdn6LTbCIUjh5QGScOHuthiE87gFS7Jf3j7dlZua0nOa8XWZmZvnarvuz3D7+vT+Xj289b++6m+fbOf+jz3lv3YfnO+o97Jz/qO902HvwP9u07tbzZt3O5f25c/zq7+sNtq3z7HNsvv7R+X/7/P9kjrl23tHf4cnn+PPv8PP6s9cBAHIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAICgTx0lEOd6Cm/WAAAAAElFTkSuQmCC\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>cmocean_Algae</strong> </div><div class=\"cmap\"><img alt=\"cmocean_Algae colormap\" title=\"cmocean_Algae\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAHHRFWHRUaXRsZQBjbW9jZWFuX0FsZ2FlIGNvbG9ybWFwAdDCRAAAACJ0RVh0RGVzY3JpcHRpb24AY21vY2Vhbl9BbGdhZSBjb2xvcm1hcJyALAEAAAAwdEVYdEF1dGhvcgBNYXRwbG90bGliIHYzLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ/e3zs8AAAAydEVYdFNvZnR3YXJlAE1hdHBsb3RsaWIgdjMuNS4xLCBodHRwczovL21hdHBsb3RsaWIub3Jn2RFR6AAAAZdJREFUeJzt1rtSg1AUQNGj//9xdn6LTbCIUjh5QGScOHuthiE87gFS7Jf3j7dlZua0nOa8XWZmZvnarvuz3D7+vT+Xj289b++6m+fbOf+jz3lv3YfnO+o97Jz/qO902HvwP9u07tbzZt3O5f25c/zq7+sNtq3z7HNsvv7R+X/7/P9kjrl23tHf4cnn+PPv8PP6s9cBAHIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAIAgAQAAQQIAAIIEAAAECQAACBIAABAkAAAgSAAAQJAAAICgTx0lEOd6Cm/WAAAAAElFTkSuQmCC\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#d7f9d0ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #d7f9d0ff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#122414ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #122414ff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.LinearSegmentedColormap at 0x10fa0c700>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from palettable.cmocean.sequential import Algae_3,Dense_3,Haline_3,Matter_3,Oxy_3,Thermal_3\n",
    "\n",
    "cmocean_list = [Algae_3,Haline_3,Dense_3,Thermal_3,Matter_3,Oxy_3]\n",
    "cmocean_list = [cmap.mpl_colormap for cmap in cmocean_list]\n",
    "for cmap in cmocean_list: cmap.name = 'cmocean_'+cmap.name.split('_')[0]\n",
    "cmocean_list[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.colors.LinearSegmentedColormap at 0x10fa23d90>,\n",
       " <matplotlib.colors.LinearSegmentedColormap at 0x10fa23d00>,\n",
       " <matplotlib.colors.LinearSegmentedColormap at 0x10fa23d30>,\n",
       " 'abcd',\n",
       " <matplotlib.colors.LinearSegmentedColormap at 0x10fa0c700>,\n",
       " <matplotlib.colors.LinearSegmentedColormap at 0x10fa0cf70>,\n",
       " <matplotlib.colors.LinearSegmentedColormap at 0x10fa0cfa0>,\n",
       " <matplotlib.colors.LinearSegmentedColormap at 0x10fa0c400>,\n",
       " <matplotlib.colors.LinearSegmentedColormap at 0x10fa0c520>,\n",
       " <matplotlib.colors.LinearSegmentedColormap at 0x10fa0c4c0>]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[*div_cmaps,'abcd',*cmocean_list]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'palettable_list' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m/var/folders/87/2kv01skd4471fn2y8rcqj6700000gn/T/ipykernel_15385/2836498877.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     43\u001b[0m         \u001b[0;34m'Oranges'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     44\u001b[0m         \u001b[0;34m'binary'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 45\u001b[0;31m         ]+palettable_list\n\u001b[0m\u001b[1;32m     46\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     47\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcolormapsList\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'palettable_list' is not defined"
     ]
    }
   ],
   "source": [
    "def plot_cmap(colormaps, pts, dpi=72,manual_cmaps=None):\n",
    "    ny, nx = pts.shape\n",
    "    ny *= len(colormaps)\n",
    "\n",
    "    ## create a square image that has a precise number of pixels\n",
    "    ##  a row for each colormap\n",
    "    f, ax = plt.subplots(len(colormaps),1, figsize=(nx/dpi, ny/dpi), dpi=dpi)\n",
    "    plt.subplots_adjust(wspace=0, hspace=0, bottom=0, top=1, left=0, right=1)\n",
    "\n",
    "    ## plot a color gradient in each axis\n",
    "    for i,c in enumerate(colormaps):\n",
    "        ax[i].imshow(pts, aspect='equal', cmap=c)\n",
    "        ax[i].axis('off')\n",
    "        \n",
    "    if manual_cmaps is not None:\n",
    "        for i,cmap in enumerate(manual_cmaps):\n",
    "            print('replacing',colormaps[i])\n",
    "            ax[i].imshow(cmap,aspect='equal')\n",
    "\n",
    "gradient = np.linspace(0, 1, 256)\n",
    "colormapsList= [\n",
    "        'viridis',\n",
    "        'plasma',\n",
    "        'inferno',\n",
    "        'magma',\n",
    "        'afmhot',\n",
    "        new_cmap,\n",
    "        newer_cmap,\n",
    "        'bwr',\n",
    "        'coolwarm',\n",
    "        'ocean',\n",
    "        'gist_earth',\n",
    "        'terrain',\n",
    "        'bone',\n",
    "        'PRGn',\n",
    "        'BrBG',\n",
    "        *cmaps,\n",
    "        *div_cmaps,\n",
    "        'Purples',\n",
    "        'Blues',\n",
    "        'Greens',\n",
    "        'Oranges',\n",
    "        'binary',\n",
    "        *cmocean_list\n",
    "        ]\n",
    "\n",
    "print(len(colormapsList))\n",
    "## thickness of each row in pixels\n",
    "ny = 8\n",
    "\n",
    "## create a grid of gradient points\n",
    "pts = np.zeros((ny,gradient.size))\n",
    "pts[:,] = gradient\n",
    "\n",
    "## make image\n",
    "plot_cmap(colormapsList[::-1], pts) #reversed order for consistency with Mahlet's version\n",
    "\n",
    "\n",
    "plt.savefig(\"colormap.png\", bbox_inches='tight',pad_inches=0)\n",
    "plt.show()\n",
    "\n",
    "colormapsList = [name if type(name) == str else name.name for name in colormapsList ]\n",
    "\n",
    "## write colormap names out\n",
    "with open(\"colormap_names.json\",'w') as handle:\n",
    "    handle.write('{\"names\":%s'%str(colormapsList).replace(\"'\",'\"')+'}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.9.7"
  },
  "vscode": {
   "interpreter": {
    "hash": "11aaa3267b22ae31752e49491423e0b73cce45474e5b4cdee357f7fe2e78f442"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
