Zoom behavior in figure embedded in GUI

1 view (last 30 days)
Sara
Sara on 22 Oct 2014
Answered: Image Analyst on 22 Oct 2014
I have built a GUI that contains some axes and created a pushbutton to let the user zoom in and out of the image. I can't figure out how to control the zoom properties though. If I plot in a figure outside the GUI, when I zoom in the portion of the original figure that lays outside the axes is not plotted anymore. When I plot in the axes embedded into the GUI, all the elements of the figure are still visible after zooming in and part of the is outside the axes limits. I have attached an image to explain what I mean. Is there a way to show only the portion inside the axes for axes within a GUI?
Thanks in advance

Answers (2)

Adam
Adam on 22 Oct 2014
What is the value of the 'Clipping' property of both the axes and the objects in question?
By default axes clipping should be on so unless you have switched it off this doesn't sound like a problem.
However, the individual objects also have a 'Clipping' property which will determine whether the object is clipped or not.
I cannot tell from your screenshots, but are the shapes that are entirely outside of the zoomed axes also still plotted somewhere on the GUI or is it just shapes some part of which lies still within the zoomed axes which are still showing.
If it is the latter then I would guess that they have 'Clipping' set to off. I'm not familiar with plotting shapes like what you show on axes though (I tend to plot images or line plots mostly and they clip as they should by default) so I may be incorrect in that guess.
  2 Comments
Sara
Sara on 22 Oct 2014
The clipping is on for both the patches and the axes. The axes are included in a panel and the patches are shown till the panel border (larger than the axes).
Sara
Sara on 22 Oct 2014
Found! It was a problem with the renderer, painters instead of zbuffer, but thanks.

Sign in to comment.


Image Analyst
Image Analyst on 22 Oct 2014
You need to use imscrollpanel(). Attached is a demo that I got from the Mathworks image processing team (that I spiffed up a little). Sorry it's not simpler but this is their recommended way.

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!