Aligning axes of different sizes within a GUI

3 visualizaciones (últimos 30 días)
Bala
Bala el 10 de Feb. de 2015
Comentada: Bala el 11 de Feb. de 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 comentarios
Adam
Adam el 11 de Feb. de 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
Bala
Bala el 11 de Feb. de 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!

Iniciar sesión para comentar.

Respuestas (1)

Sumit Tandon
Sumit Tandon el 10 de Feb. de 2015
Check out the ALIGN function. Calling this function after the axes have been populated with the images should do the trick.
  1 comentario
Bala
Bala el 11 de Feb. de 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!

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by