Zooming a portion of a plot
    44 views (last 30 days)
  
       Show older comments
    
Good evening to all,
I am a beginner in Matlab programming. I have a problem related to the plot of figures. Indeed, I want to see how a numerical analysis error evolves as a function of time, so the error function is concentrated around the origin on the y axis. How can I zoom in on this part of the plot? I have tried ylim([   ]) but I am not satisfied because there is a rapid decay that I can't see, so a zoom that keeps the coordinates of the points will be useful.
Best regards,
5 Comments
  Mathieu NOE
      
 on 19 Apr 2023
				Could you share the plotted data as mat file ? 
I don't have the symbolic toolbox
Answers (1)
  Amith
    
 on 23 May 2023
        Hi,
As per my understanding you wanted to zoom at a particular portion of the plot to get a clearer picture of that portion. In that case you can use 
zoom function: The zoom function allows you to interactively zoom in and out of a plot using the mouse. When you call this function, the cursor turns into a magnifying glass with a plus sign. Clicking and dragging a rectangular area of the graph will zoom in on that area. Pressing the "Alt" key while clicking and dragging will zoom out instead. The zoom function also returns a handle to a zoom object that you can manipulate programmatically if you need to. 
For example:
x = linspace(0,10,1000);
y = sin(x);
plot(x,y);
zoom on  % Enables interactive zooming on the plot
or alternatively use the magnifying button on the top of the plot to enable this function.
You can also look into this answer if you need a different kind of zoom for your purpose Zooming a portion of figure in a figure. - MATLAB Answers - MATLAB Central (mathworks.com)
0 Comments
See Also
Categories
				Find more on Data 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!


