"# This makes the original colorbar look a bit out of place,\n",
"# so let's improve its position.\n",
"\n",
"l, b, w, h = plt.gca().get_position().bounds\n",
"ll, bb, ww, hh = CB.ax.get_position().bounds\n",
"CB.ax.set_position([ll, b + 0.1*h, ww, h*0.8])\n",
"\n",
"\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:20: MatplotlibDeprecationWarning: The bivariate_normal function was deprecated in version 2.2.\n",
"/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:21: MatplotlibDeprecationWarning: The bivariate_normal function was deprecated in version 2.2.\n"
]
},
{
"data": {
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<Figure size 640x480 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\"\"\"\n",
"Illustrate simple contour plotting, contours on an image with\n",
"a colorbar for the contours, and labelled contours.\n",