GUI - How to place subplot over image?
2 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
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
Walter Roberson
on 5 Jan 2012
When you use uipanel() you may need to explicitly turn on its Clipping property.
More Answers (0)
See Also
Categories
Find more on Subplots 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!