Skip to content

Instantly share code, notes, and snippets.

@slinderman
Last active May 17, 2017 03:28
Show Gist options
  • Save slinderman/b9f7bc193926a0706dfc109dde21a615 to your computer and use it in GitHub Desktop.
Save slinderman/b9f7bc193926a0706dfc109dde21a615 to your computer and use it in GitHub Desktop.
Colors!
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAqsAAAD9CAYAAACbUz4yAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADp5JREFUeJzt3XuMlfWdx/HvwMjFAYHiNBvFBdPEG0STQkyNwdBEvCV2\ng1IZZ2AgRd1F25B2VASplyigyUZWU5sWNTGMo7iNNJqNu2TRVlvSRLzUOEazS7SlWKsj6ArDzsJc\n9g9XFmdlO2dO5Pc99fX6jzkQPoQ587zPM895pm5gYGAgAAAgoRGlBwAAwJGIVQAA0hKrAACkJVYB\nAEhLrAIAkFb9kR7o6emJzs7OaGxsjJEjRx7NTQAAfIn09fVFV1dXzJgxI8aMGfOZx44Yq52dndHS\n0vKFjwMAgIiIjo6OmDVr1mc+dsRYbWxsjIiI+3bujMbe3i922Rfkb5c9VnpCVTbPWlJ6QlXuGVhc\nekJVRv3zxNIThu3vvvIPpSdUZVvPnNITqjLn+O+UnlCVf5r676UnVKX+b5pLTxi2f1n/j6UnVOU7\nf91UekJV/u2yfy09oSrz/35b6QnD9qf9PdHy/PZD/Xm4I8bqp9/6b+ztjb+q0Vgd2XB86QlVmfKV\nvtITqtIwcGzpCVUZPWZ86QnDduKxtfmc/dTkulGlJ1Rlyrja/tozaeJ7pSdUpX7KiaUnDNvohgml\nJ1SlceKU0hOq8v6Ur5SeUJUpDWNLT6ja51166g1WAACkJVYBAEhLrAIAkJZYBQAgLbEK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/qO2o0is\nbt26NQ4cOBCbNm2Ktra2WLduXYkZw/bggw/G6tWr4+DBg6WnVOypp56KSZMmRUdHRzzwwANxxx13\nlJ5UkWeffTbq6urisccei+XLl8c999xTelLFent749Zbb/0/t+aoBQcOfHKz/o0bN8bGjRtj7dq1\nhRdV5oUXXohXXnklNm3aFO3t7fHuu++WnlSRefPmRXt7e2zcuDGmT58eq1evjnHjxpWeNSTPPfdc\n9Pf3x6ZNm+Laa6+N9evXl55UkZ/97GfR0NAQjz/+eKxevbpmQm/w8WrdunXxgx/8IB555JHo7++P\nrVu3Fl74/xu8f8+ePXH11VfHL37xi8LLhmbw/rVr18Ytt9wSGzdujLlz58aGDRsKLzyywdvXr18f\nbW1t8eijj0ZEHNWTXUVi9aWXXorZs2dHRMRZZ50VnZ2dJWYM29SpU+P+++8vPWNYLr744li+fHlE\nfHKWsr7GfkLZ+eeffyiw33nnnZgwYULhRZW7++6748orr4yvfvWrpadU7M0334z9+/fH0qVLY8mS\nJfHqq6+WnlSRX//613HKKafEtddeG8uWLYtvfvObpScNy2uvvRY7duyIb3/726WnDNm0adOir68v\nBgYGYu/evXHMMceUnlSRHTt2xHnnnRcRESeffHK89dZbhRcNzeDj1euvv37ohuvnnXde/OY3vyk1\nbUgG79+/f39873vfi29961sFVw3d4P3r16+PU089NSI+OXExevToUtP+rMHbf/SjH8XMmTPjwIED\n0dXVFePHjz9qW4rE6r59+z7zj6yvrz+qp5OrNXfu3Jr9QQljx46NY489Nvbt2xfLly+P73//+6Un\nVWzEiBFx0003xZo1a+LSSy8tPacimzdvjsmTJ8e5554btXiL4zFjxsTSpUvjoYceittuuy2uv/76\nmnrufvjhh9HZ2Rn33Xdf3HbbbdHW1lZ60rBs2LAhvvvd75aeUZGGhobYtWtXXHTRRXHLLbfU3GVU\np59+evzyl7+MiIjf/va38f7779fEc3jw8erwzQ0NDbF3794Ss4Zs8P4pU6bEmWeeWXBRZQbvP/74\n4yMi4uWXX45HH300lixZUmjZnzd4e11dXfzx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FpiFQCAtP4bTX0c\nVAUNpAMAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x11a675320>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib.patches import Rectangle\n",
"import seaborn as sns\n",
"%matplotlib inline\n",
"\n",
"color_names = [\"red\",\n",
" \"windows blue\",\n",
" \"amber\",\n",
" \"faded green\",\n",
" \"dusty purple\",\n",
" \"orange\",\n",
" \"clay\",\n",
" \"pink\",\n",
" \"greyish\",\n",
" \"light cyan\",\n",
" \"steel blue\",\n",
" \"pastel purple\",\n",
" \"mint\",\n",
" \"salmon\"]\n",
"\n",
"colors = sns.xkcd_palette(color_names)\n",
"n_colors = len(colors)\n",
"sns.set_style(\"white\")\n",
"\n",
"fig = plt.figure(figsize=(12,4))\n",
"ax = fig.add_subplot(111)\n",
"for n in range(n_colors):\n",
" ax.add_patch(Rectangle((n,0),1,1, facecolor=colors[n], edgecolor=\"none\"))\n",
"\n",
"ax.set_xlim(0,n_colors)\n",
"ax.set_xticks(np.arange(n_colors)+0.5)\n",
"ax.set_xticklabels(np.arange(n_colors))\n",
"ax.set_ylim(0,1)\n",
"ax.set_yticks([])\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [Root]",
"language": "python",
"name": "Python [Root]"
},
"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.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment