Axis position / size changing with figure resize in GUI

10 views (last 30 days)
Hi All,
I have been working on a manual contouring program for 2D images for the purpose of contouring X-ray images and images of bone cross sections but have run into an interesting problem after I maximize the figure by dragging it to the top of the screen and then try to move it. It seems to change my axis size and / or position. Example below:
The first image shows the cursor in the zoom mode as it should be but if I move the cursor a little the zoom goes away because the cursor has left the bounds of the axis. I apologize for the quality of the image. I had to take it with my phone because screen captures and snipping tools don't capture the cursor.
IMG1
IMG2
I only define the axes once and after they're initially made I only add Child graphics objects in the form of lines. Any help with issue would be greatly appreciated as I don't quite understand all of the intricacies of MATLAB graphics.
Thanks, James Peters
Graphics Initialization code:
UIObjects = struct; % Storage for pieces of the UI
UIObjects.Fig = figure('Units', 'pixels', 'Position', [100, 100, 800, 800],...
'MenuBar', 'none', 'ToolBar', 'none', 'UserData', UserData);
UIObjects.Ax = axes('Parent', UIObjects.Fig, 'Position', [0.1, 0.15, 0.8, 0.8],...
'Visible', 'off');
UIObjects.Image = imshow(Data, 'Parent', UIObjects.Ax);

Answers (1)

Walter Roberson
Walter Roberson on 28 Mar 2016
You are defining your axes using the default normalized coordinates. If the containing figure changes size, then the axes should change size as well.
Beyond that, I do not understand what you are asking with regards to the two different cursors? Are you saying that if you resize the figure, that zoom mode turns off?
  1 Comment
James
James on 28 Mar 2016
Hi Walter,
Thank you for responding. I am using the default normalized coordinates as far as I know. What is happening is when I maximize the figure either by using the button or by dragging the window to the top of the screen (windows 10) and then resize it again by dragging it away, if this is done too quickly, the axes actually seem to shift position in the figure. The image shown in the figure doesn't move, but the range of the axes must because when I have the zoom enabled I can only click on certain regions of the image. The only difference between the two pictures above is me moving my cursor down.

Sign in to comment.

Categories

Find more on Visual Exploration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!