Axis position / size changing with figure resize in GUI
10 views (last 30 days)
Show older comments
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);
0 Comments
Answers (1)
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?
See Also
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!