Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Adding line/rectangle to an image in a axis on a GUI
Replies: 2   Last Post: Oct 31, 2012 3:25 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Scott

Posts: 13
Registered: 10/31/12
Re: Adding line/rectangle to an image in a axis on a GUI
Posted: Oct 31, 2012 2:01 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I may have found the answer by trying some different search terms in the newsreader than I had before:

as per:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/286314
and
http://www.mathworks.com/matlabcentral/newsreader/view_thread/322516#890283

The following two alternatives seemed to work:
(1)
axes(myData.axis1) %alternatively set(myData.figHandle,'CurrentAxes',myData.axis1)
curAxisProps=axis;
hRect=rectangle(...);
axis(curAxisProps)

(2)
axes(myData.axis1) %alternatively set(myData.figHandle,'CurrentAxes',myData.axis1)
set(gca,'xlim',xlim(gca),'ylim',ylim(gca))
hRect=rectangle(...);

So is the problem that matlab rescales an axis to fit the latest child of it?
I tested this by having matlab remake the image after I made the rectangle:

axes(myData.axis1) %alternatively set(myData.figHandle,'CurrentAxes',myData.axis1)
hRect=rectangle(...);
axis1_Pict=imshow(myData.axis1_image,'Parent',myData.axis1)

and the picture showed up normal scale (but without the rectangle)

If anyone has better suggestions for a solution or just a better explanation of what is happening, I'd appreciate it. For now, though, (1) or (2) seem to work.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.