# [Scilab-users] Zoom in plot Classic List Threaded 3 messages Open this post in threaded view
|

## [Scilab-users] Zoom in plot Hi, I was looking for a way to have a zoom inside a plot. I didn't find any example, so I tried to do myself. Let me know if there is a better way to do it (for instance, if is it possible to avoid to repeat the *plot* command) clf() // main axes x = 0:0.1:20; plot(x, acosh(x),"r", x, asinh(x), "g") a = gca() a.axes_bounds = [0, 0, 1, 1]; legend(["acosh", "asinh"], pos = "in_upper_left") xpoly([0, 0, 2, 2], [0, 1, 1, 0]) xarrows([2, 12], [.5, 1.5], 8) // zoom axes z = newaxes(); z.axes_bounds = [.6, .3, .2, .5]; plot(x, acosh(x),'r', x, asinh(x), "g") zoom_rect(z, [0, 0, 2, 1]) -- Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html_______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users Hello, Le 24/07/2020 à 10:43, torpedo a écrit : ```Hi, I was looking for a way to have a zoom inside a plot. I didn't find any example, so I tried to do myself. Let me know if there is a better way to do it (for instance, if is it possible to avoid to repeat the *plot* command)``` Yes, you may use copy(), as it follows. The legend must be delayed, otherwise it is copied as well, as a member of the initial axes: ```clf() // main axes x = 0:0.1:20; plot(x, acosh(x),"r", x, asinh(x), "g") a = gca(); a.axes_bounds = [0, 0, 1, 1]; xpoly([0, 0, 2, 2], [0, 1, 1, 0]) xarrows([2, 12], [.5, 1.5], 8) // zoom axes z = copy(a); z.axes_bounds = [.6, .3, .2, .5]; zoom_rect(z, [0, 0, 2, 1]) legend(a, ["acosh", "asinh"], pos = "in_upper_left")``` Regards Samuel _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users *copy()* is just what I was looking for, but, then, also *xpoly()* and *xarrows()* have to be delayed (otherwise they are printed in the zoom axes) clf() // main axes x = 0:0.1:20 plot(x, acosh(x),"r", x, asinh(x), "g") a = gca() a.axes_bounds = [0, 0, 1, 1] // zoom axes z = copy(a) z.axes_bounds = [.6, .3, .2, .5] zoom_rect(z, [0, 0, 2, 1]) sca(a)  // make main axes current legend(["acosh", "asinh"], pos = "in_upper_left") xpoly([0, 0, 2, 2], [0, 1, 1, 0]) xarrows([2, 12], [.5, 1.5], 8) -- Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html_______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users