How to Change the physical dimensions of a figure in a GUI?

Hello. I have a GUI that takes a matrix of size (a b) and images the data on an axis. The main purpose of this GUI is to analyze an image of a diffraction pattern, and my goal is to conserve the dimensions of the original data. My issue is that I am unable to figure out how to change the physical dimensions of my axis depending on the size of my matrix. Just to reiterate I already have the x,y values displayed on my axis, but when I image my data the pixel size is distorted depending on the size of the matrix. Is there any way to change the size of the figure to be the same as the size of the matrix without going back to guide and dragging the axis to a new position?
Thank you,
-Eric

 Accepted Answer

I'm not exactly sure what you mean, but you might try using "axis equal" or "axis square" or setting the units property of the axes to "normalized". Or maybe display with imshow's "InitialMagnification" option set to 100. I might have a better answer if I could see the "good" GUI image and the "bad" GUI image (screenshots) so I can visualize what you're describing.

1 Comment

I believe I determined the solution to be simply changing the DataAspectRatioMode to manual, the PlotBoxAspectRatioMode to manual, and the NextPlot to new. Thank you very much for your quick response!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!