{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Simple ImageGrid 2\n\nAlign multiple images of different sizes using\n`~mpl_toolkits.axes_grid1.axes_grid.ImageGrid`.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n\nfrom matplotlib import cbook\nfrom mpl_toolkits.axes_grid1 import ImageGrid\n\nfig = plt.figure(figsize=(5.5, 3.5))\ngrid = ImageGrid(fig, 111, # similar to subplot(111)\n nrows_ncols=(1, 3),\n axes_pad=0.1,\n label_mode=\"L\",\n )\n\n# demo image\nZ = cbook.get_sample_data(\"axes_grid/bivariate_normal.npy\")\nim1 = Z\nim2 = Z[:, :10]\nim3 = Z[:, 10:]\nvmin, vmax = Z.min(), Z.max()\nfor ax, im in zip(grid, [im1, im2, im3]):\n ax.imshow(im, origin=\"lower\", vmin=vmin, vmax=vmax)\n\nplt.show()" ] } ], "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.13.2" } }, "nbformat": 4, "nbformat_minor": 0 }