This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Display multiple images in single figure

subimage is not recommended. Use imshow instead.


subimage(X, map)
subimage(x, y...)
h = subimage(...)


You can use subimage in conjunction with subplot to create figures with multiple images, even if the images have different colormaps. subimage works by converting images to truecolor for display purposes, thus avoiding colormap conflicts.

subimage(X, map) displays the indexed image X with colormap map in the current axes.

subimage(I) displays the intensity image I in the current axes.

subimage(BW) displays the binary image BW in the current axes.

subimage(RGB) displays the truecolor image RGB in the current axes.

subimage(x, y...) displays an image using a nondefault spatial coordinate system.

h = subimage(...) returns a handle to an image object.

Class Support

The input image can be of class logical, uint8, uint16, or double.


load trees
[X2,map2] = imread('forest.tif');
subplot(1,2,1), subimage(X,map)
subplot(1,2,2), subimage(X2,map2)

See Also


Introduced before R2006a