Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting images to show side by side in matlab

Tags:

matlab

Am trying to get 3 images to be show side by side in matlab. But when I use subplot they are being spaced out unevenly. The first and second is a 25-by-25 pxl image and the third is a 25-by-75 image.

How can i get it to be show like

+-----++-----++---------------+
| img || img ||     img       |
|  1  ||  2  ||      3        |
+-----++-----++---------------+
like image 692
cubearth Avatar asked Dec 09 '22 01:12

cubearth


2 Answers

You can use subplot to span multiple grid squares. For your example try

subplot(1,4,1)
subplot(1,4,2)
subplot(1,4,3:4) % this will expand the third axes over the last two grid squares

Note:

The position of the axes can be h=subplot(...) returns the handle to the newly created axes. You can then use set to adjust the axes or you can use

h=subplot('position', [left bottom width height])

manually place the axes in the figure. Also, note the functions get(h,'prop') and set(h,'prop',value) are also available to adjust other axes properties. See the MATHWORK's handle graphics browser section on axes for documentation on all the available properties.

like image 131
Azim J Avatar answered Dec 19 '22 15:12

Azim J


Another alternative is to create a new image:

abuttedImage = [im1 im2 im3]; 

This will work as long as the number of rows in each image are the same.

like image 34
Ashish Uthama Avatar answered Dec 19 '22 13:12

Ashish Uthama