Aligning axes of different sizes within a GUI

2 views (last 30 days)
Bala
Bala on 10 Feb 2015
Commented: Bala on 11 Feb 2015
Hello,
I have a trivial question but not able find a effective solution. I hope somebody could help me in this regard.
I currently have 4 different axes in a GUI. ax1(top left) and ax4(bottom left) should be aligned vertically and similarly ax2(top right) and ax4(bottom right) should be aligned vertically. (I have attached a sample image)
ax1 and ax2 are used to show images that are usually larger in size(~512x512) and ax3 & ax4 are used to display images of size ~43x512. Even though I created the axes with x-axis the same size when I display images they change size and not aligned anymore. No matter what images I display, I want the top and bottom images to of same x length and aligned always.
I tried to keep the XLim the same; XData the same but still doesnt work.
Any help is greatly appreciated.
Thanks, Bala
  5 Comments
Bala
Bala on 11 Feb 2015
Hi Adam,
I use imshow to display images. (i.e. hI = imshow(im,[int1 int2])) You are right. Imshow is resizing the axes to match the im size. I played around with Positon property but didnt help much. I will look into other two but any quick hints might be helpful.
Thanks again!

Sign in to comment.

Answers (1)

Sumit Tandon
Sumit Tandon on 10 Feb 2015
Check out the ALIGN function. Calling this function after the axes have been populated with the images should do the trick.
  1 Comment
Bala
Bala on 11 Feb 2015
Hi Sumit,
Thanks for your reply. But Align is just not what I need. Looks like I need something to resize to match the axes above. I think what I found is, if the size of the image is different from the axes size, the image resizes automatically and hence not the same size as axes when displayed. So I guess I need something(a command or property) that will fill the axes when displayed.
thanks!

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!