Zoom box in a plotyy

3 views (last 30 days)
Héctor Rubén Díaz
Héctor Rubén Díaz on 12 Jul 2017
Commented: Walter Roberson on 12 Jul 2017
Hi,
I ploted a graph based on four curves. They have diferent scale, so I use plotyy function. Besides, in order to plot the 2 different graphs, I use hold on in order to plot one and then the following one, with is not the best idea.
Now, I want to take a zoom of a specific region in my plot. There are lot of options avaliable for doing this task but I cannot find anyone that takes the 2 scales plot. In other words, I would like to get a zoom for the plot attached.
Is there any suggestion?

Answers (2)

Walter Roberson
Walter Roberson on 12 Jul 2017
You can link the zoom using linkaxes or linkprop. I seem to recall that linkaxes is done automatically for plotyy with respect to the x axes. Linking with respect to the y axes of a plotyy is trickier because the two might have different ylim

Héctor Rubén Díaz
Héctor Rubén Díaz on 12 Jul 2017
Edited: Walter Roberson on 12 Jul 2017
Really, I do not understand how you can use linkaxes. Just for being clear, I wanna do a kind of http://blogs.mathworks.com/pick/2011/09/09/detect-curve-intersections-quickly-and-easily/ plot extract but with differents scales. So then, how can I use your advice in it?
[AX,hLine1,hLine2] = plotyy(t,X,t,Y); grid on;
hold on;
[AX1,hLine11,hLine21] = plotyy(t1,X1,t1,Y1); grid on;
  1 Comment
Walter Roberson
Walter Roberson on 12 Jul 2017
Could you confirm that in your second plotyy that the x axes values, t1, are a different range than the x axis values for the first plot, t ? If so that complicates matters.

Sign in to comment.

Categories

Find more on Two y-axis 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!