attempt to change the axis of an axes limits remove the original image
5 views (last 30 days)
Show older comments
Hello, I created GUI with several axis and pushing buttons. I loaded binary image to specific axes (let call it axes1). now i would like to change the image axis so it will be tight on the image and than plot on the image afterwards.
now i've been noticed that if i tried to change the image axis the image remove (the axes area turns gray). this is my code:
axes(handles.axes1)
imageAxes1 = imshow(temp_struct.binary_image);
axis([xmin xmax ymin ymax]);
hold on
and from some reason it doesn't work. there are any specific rule for changing axis in GUI? by the way i am using the guide for building the gui.
Thanks.
1 Comment
dpb
on 11 May 2014
Edited: dpb
on 11 May 2014
I don't have the toolbox so I don't know just what the image object is, precisely, but I wonder if by first creating an axes object then the image object you don't have dueling axes wherein you've changed the limits on the current handle graphics object which is axes1 rather than for the image object axes. The grayout to me implies this that you've made that background axes now the foreground so it's masking the image.
Again, I don't have the Toolbox so can't test, but I'd suggest you dispense with the call to axes and use imshow and it's handle and properties exclusively.
IA has been around this AM, he's the expert; maybe he'll notice this and have the definitive answer altho I suspect it's at least related to the above altho that may not be the optimum solution. (Besides not having the toolbox, I don't do GUIs.)
Accepted Answer
Image Analyst
on 11 May 2014
Edited: Image Analyst
on 12 May 2014
I'd just do this:
axes(handles.axes1)
imshow(temp_struct.binary_image);
axis on; % Or off.
hold on
You can set axis limits with xlim() and ylim() though I don't know why you'd do that, and I'm not sure you can, if you've displayed an image first.
2 Comments
Image Analyst
on 12 May 2014
Not sure either, but it's what I always do. I never do what you did first, though it may be allowed, so I'm not familiar with when that way of calling it should be used. Glad it worked though.
More Answers (0)
See Also
Categories
Find more on Graphics Object Programming 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!