Image Processing Toolbox User's Guide Previous page   Next Page

Displaying Multiple Images in the Same Figure

You can use the imshow function with the MATLAB subplot function or the MATLAB subimage function to display multiple images in a single figure window.

Dividing a Figure Window into Multiple Display Regions.   subplot divides a figure into multiple display regions. The syntax of subplot is

This syntax divides the figure into an m-by-n matrix of display regions and makes the pth display region active.

For example, you can use this syntax to display two images side by side.

In the figure, note how the first image displayed, X1, appears dark after the second image is displayed.

Two Images in Same Figure Using the Same Colormap

Using the subimage Function to Display Multiple Images.   subimage converts images to truecolor before displaying them and therefore circumvents the colormap sharing problem. This example uses subimage to display the forest and the trees images with better results.

Two Images in Same Figure Using Separate Colormaps


Previous page  Displaying Each Image in a Separate Figure Displaying Different Image Types Next page

© 1994-2005 The MathWorks, Inc.