Comments on: Linked zoom and constrained zoom in MATLAB https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/?s_tid=feedtopost Stuart uses video to share his experiences solving problems with MATLAB day-to-day, interesting new features, plus tips and tricks he has picked up along the way. Tue, 16 Aug 2016 08:23:40 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: viec lam can tho https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-65986 Tue, 16 Aug 2016 08:23:40 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-65986 Very nice post. I simply stumbled upon your blog and wanted
to say that I have really enjoyed surfing around your weblog posts.
After all I will be subscribing to your feed and I’m hoping you write again very soon!

]]>
By: Marie https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-185 Sun, 30 Mar 2008 22:56:03 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-185 Dear Daphne and Doug,

I had the same problem with trying to link images. The problem arises from the fact that the handle returned from image scale is not an axis and linkaxes’ error checking throws an exception. I checked the parent, and it is an axis. Linking the two parent axes gives the correct behavior:

% Link two images
% get(h, ‘Parent’) returns the axes associated
% with the images. I don’t think this is documented
% behavior, so it is probably subject to breakage, and
% really should be moved into a supported function
% such as linkprop/linkaxes with the appropriate function.
% As get(h, ‘Parent’) returns a cell array, we need to
% convert it to a matrix.

linkaxes(cell2mat(get(h, ‘Parent’)), ‘xy’);

Doug, I don’t know enough about when Matlab replaces axes to know whether this will survive Daphne’s replot…

Best wishes,
Marie

]]>
By: Daphne https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-184 Mon, 10 Dec 2007 20:42:53 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-184 Hi Doug,
If only life were so simple. My “plots” are actually images from a microscope, which I pre-process in the gui to determine filter parameters etc. I use imagesc to show them.
I have tried setting the xlim, ylim to the zoomed value, but didn’t quite work. Will try again to find the right place to redefine.

Thanks for the input,
Daphne

]]>
By: Doug https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-183 Mon, 10 Dec 2007 18:14:44 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-183 Daphne,

When you do the plot again, MATLAB may be creating a new axes that replaces the original. Some plot routines do this quietly. You need to set up the xlim, ylim, and linkaxes again when this happens. Depending on the kind of plot you are doing, it might be better to do a LINE, rather than a PLOT. This is more surgical, and changes less of the props in the axes and such.

Doug

]]>
By: Daphne https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-182 Sun, 09 Dec 2007 14:52:05 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-182 Hi Doug,
I know this is a long time after the post, but am hoping you will still get to this.
I would like to link a few axes and have them zoom in togetehr, however the problem is that these axes are each plotted separately.
I have 3 axes in a GUI. Each one is a step in an image processing procedure that I am running. I would like to be able to zoom in on the 1st axes, then plot the second and have the zoom remain (same for when I add the 3dd plot). I have been able to do this for the first time, but then if I replot always returns to full size.
Help?

Thanks,
Daphne

]]>
By: Doug https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-181 Fri, 23 Feb 2007 14:33:33 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-181 If you have an older version of MATLAB (before this function was introduced) you can get much the same effect by using SET, GET, and callbacks that will change the xlim and ylim properties of the other axes.

Not as easy, but it can be made to work. It might just be better to get the newest version of MATLAB.

Doug

]]>
By: Peter Moses https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-180 Fri, 23 Feb 2007 08:57:13 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-180 How can I implement the linkaxes function within Matlab 6? Thanks

]]>
By: Doug Hull https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-179 Fri, 09 Feb 2007 21:26:31 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-179 If you want to link axes but not lock them exactly together, you can do that with the set and get commands to set the xlim and ylim properties of the axes. This is likely done with callbacks too.

Doug

]]>
By: Andrew.H https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-178 Thu, 08 Feb 2007 08:17:20 +0000 https://blogs.mathworks.com/videos/2006/11/27/linked-zoom-and-constrained-zoom-in-matlab/#comment-178 Hi,yes linkaxes(h,’xy’) is useful when you want to zoom in/out subplots together.but the disadvantage is that axes being linked have to have the same xy limits,how do u zoom both if your axes don’t have the same limits? i tried linkprop,but do not work.

]]>