Thursday, 3 October 2013

How to control zooming in Matlab Plot?

% Just use the following commands:

%To zoom only on x-axis
zoom xon


%To zoom only on y-axis
zoom yon

%To control the zoom on individual subplots (this code is taken from Matlab help >> help zoom)
    ax1 = subplot(2,2,1);
    plot(1:10);
    h = zoom;
    ax2 = subplot(2,2,2);
    plot(rand(3));
    setAllowAxesZoom(h,ax2,false);
    ax3 = subplot(2,2,3);
    plot(peaks);
    setAxesZoomMotion(h,ax3,'horizontal');
    ax4 = subplot(2,2,4);
    contour(peaks);

    setAxesZoomMotion(h,ax4,'vertical');


No comments:

Post a Comment