Aligning axes of different sizes within a GUI
3 views (last 30 days)
Show older comments
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
Adam
on 11 Feb 2015
How are you plotting your images?
I always use imagesc or image which stretch the image to fill the size of the axes. I think imshow will resize the axes to match the ratio of the image though so you may well need to play around with the following properties of one or other pair of axes:
Position
PlotBoxAspectRatio
DataAspectRatio
Answers (1)
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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!