{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 20596 characters]",
      "text/plain": [
       "<Figure size 640x480 with 4 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 39360 characters]",
      "text/plain": [
       "<Figure size 640x480 with 18 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 27048 characters]",
      "text/plain": [
       "<Figure size 640x480 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 29256 characters]",
      "text/plain": [
       "<Figure size 640x480 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20552 characters]",
      "text/plain": [
       "<Figure size 640x480 with 8 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 42844 characters]",
      "text/plain": [
       "<Figure size 640x480 with 17 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np  \n",
    "import matplotlib.pyplot as plt  \n",
    "  \n",
    "# Have colormaps separated into categories:  \n",
    "# http://matplotlib.org/examples/color/colormaps_reference.html  \n",
    "  \n",
    "cmaps = [('Perceptually Uniform Sequential',  \n",
    "                            ['viridis', 'inferno', 'plasma', 'magma']),  \n",
    "         ('Sequential',     ['Blues', 'BuGn', 'BuPu',  \n",
    "                             'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd',  \n",
    "                             'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu',  \n",
    "                             'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']),  \n",
    "         ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool',  \n",
    "                             'copper', 'gist_heat', 'gray', 'hot',  \n",
    "                             'pink', 'spring', 'summer', 'winter']),  \n",
    "         ('Diverging',      ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr',  \n",
    "                             'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral',  \n",
    "                             'seismic']),  \n",
    "         ('Qualitative',    ['Accent', 'Dark2', 'Paired', 'Pastel1',  \n",
    "                             'Pastel2', 'Set1', 'Set2', 'Set3']),  \n",
    "         ('Miscellaneous',  ['gist_earth', 'terrain', 'ocean', 'gist_stern',  \n",
    "                             'brg', 'CMRmap', 'cubehelix',  \n",
    "                             'gnuplot', 'gnuplot2', 'gist_ncar',  \n",
    "                             'nipy_spectral', 'jet', 'rainbow',  \n",
    "                             'gist_rainbow', 'hsv', 'flag', 'prism'])]  \n",
    "  \n",
    "  \n",
    "nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps)  \n",
    "gradient = np.linspace(0, 1, 256)  \n",
    "gradient = np.vstack((gradient, gradient))  \n",
    "  \n",
    "  \n",
    "def plot_color_gradients(cmap_category, cmap_list):  \n",
    "    fig, axes = plt.subplots(nrows=len(cmap_list))  \n",
    "    fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99)  \n",
    "    axes[0].set_title(cmap_category + ' colormaps', fontsize=14)  \n",
    "  \n",
    "    for ax, name in zip(axes, cmap_list):  \n",
    "        ax.imshow(gradient, aspect='auto', cmap=plt.get_cmap(name))  \n",
    "        pos = list(ax.get_position().bounds)  \n",
    "        x_text = pos[0] - 0.01  \n",
    "        y_text = pos[1] + pos[3]/2.  \n",
    "        fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10)  \n",
    "  \n",
    "    # Turn off *all* ticks & spines, not just the ones with colormaps.  \n",
    "    for ax in axes:  \n",
    "        ax.set_axis_off()  \n",
    "  \n",
    "for cmap_category, cmap_list in cmaps:  \n",
    "    plot_color_gradients(cmap_category, cmap_list)  \n",
    "  \n",
    "plt.show() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 10200 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from plot_settings import *\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "colors = get_color_list(n_colors=10, cmap='viridis', color_min=0, color_max=0.9)\n",
    "\n",
    "for i in range(len(colors)):\n",
    "    plt.scatter(i, i, color=colors[i])"
   ]
  }
 ],
 "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.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
