zoomed plot in the same figure
Ältere Kommentare anzeigen
Hello i am trying to do a zoomed plot in the same figure using the plotyy function... Ive tried to play around with the explanations given here https://de.mathworks.com/matlabcentral/answers/33779-zooming-a-portion-of-figure-in-a-figure but i couldnt make it so far... The section im interested in is between the graphs plotted by (x5,y5,x6,y6) at x between 0.6 and 0.8 and y between 0.18 and 0.2.... If someboy could give me a hint i would be really greatfull. The version im using is R2012a..
Thank you very much
%Bed profile of Run 20°C
BP_num_6s_fv=xlsread('Results.xlsx','t=6s',' M3:N203');
%Velocities of Run 20°C and Run 5°C
velo6s_20=xlsread('Results.xlsx','Velocity',' I3:J203');
velo6s_5=xlsread('Results.xlsx','Velocity',' L3:M203');
% Bed profile At t=6s
x1 = BP_num_6s_fv(:,1); y1= BP_num_6s_fv(:,2);
% Velocity Run 20°C and 5°C
x5 = velo6s_20(:,1); y5 =velo6s_20(:,2);
x6 = velo6s_5(:,1); y6 =velo6s_5(:,2);
figure (1)
hold on
[ax,h1,h2]=plotyy(x1,y1,x5,y5)
h(3) = line(x6,y6, 'Parent', ax(2));
set(h(3),'Color','r')
% create a new pair of axes inside current figure
axes('position',[.65 .175 .25 .25])
box on % put box around new pair of axes
indexOfInterest = (x5 < 0.8) & (x5 >0.6); % range of t near perturbation
a=x5;
plot(a(indexOfInterest),g(indexOfInterest)) % plot on new axes
axis tight
4 Kommentare
Adam
am 17 Jul. 2017
And what does this code actually give you, what aspect of it is incorrect?
christian robledo
am 17 Jul. 2017
Adam
am 17 Jul. 2017
Would it not just be easier to set the XLim and YLim properties to the desired range?
christian robledo
am 17 Jul. 2017
Bearbeitet: christian robledo
am 17 Jul. 2017
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Two y-axis finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
