zoomed plot in the same figure
Afficher commentaires plus anciens
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 commentaires
Adam
le 17 Juil 2017
And what does this code actually give you, what aspect of it is incorrect?
christian robledo
le 17 Juil 2017
Adam
le 17 Juil 2017
Would it not just be easier to set the XLim and YLim properties to the desired range?
christian robledo
le 17 Juil 2017
Modifié(e) : christian robledo
le 17 Juil 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Two y-axis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
