GUI - How to place subplot over image?

2 views (last 30 days)
Hi, I try to place a suplot over an image in my GUI. I set the subplot and the image axes 'Parent' to be a panel. My problem is that i need that the subplot will cover just a part of the image and will get a specific location, and will not get the panel size. (I would rather use "tight_subplot" that i find in the File Exchange.)
any ideas? Thanks

Accepted Answer

Walter Roberson
Walter Roberson on 5 Jan 2012
subplot() cannot be used to overlay another axes (e.g., the axes the image is in.) This is coded in to subplot(): it looks for conflicting axes and deletes them.
You can axes() and set its position as you like. Depending on exactly what you are looking for you might want to set InnerPosition to correspond to where the image is.
Note: image objects have XData and YData properties that control the location of the center of the lower-left and upper-right pixels. Not the edge of them, the center of them. Accounting for the width of the pixels to get alignment right can be a nuisance.
  2 Comments
avi
avi on 5 Jan 2012
Thank alot. I try to place the subplot into a panel and the axes of the image in another panel. The subplot's panel is a children of the image panel - But the image cover the subplot. what is the problam?
Walter Roberson
Walter Roberson on 5 Jan 2012
When you use uipanel() you may need to explicitly turn on its Clipping property.

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!