How can I add a zoom in the peak of the curve ?
99 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mallouli Marwa
le 29 Août 2020
Commenté : Star Strider
le 3 Sep 2020
Hi
How can I add a zoom in the peak of the curve like the attached one ?
0 commentaires
Réponse acceptée
Star Strider
le 29 Août 2020
Using these data with the code I provided in my Answer to your previous Question How can I insert a detail in the peak of the curve ?
The ‘V Vectors’ , ‘V_86’, ’V_89’, ‘V_91’, ‘V_92’, ‘V_95’, are provided in ‘Mallouli Marwa V Vectors.mat’, attached.
This Code —
omega = 125.6:0.1:502.4;
freq = omega./(2*pi);
figure
ax1 = axes('Position',[0.2 0.1 0.7 0.8]);
ax2 = axes('Position',[0.25 0.65 0.15 0.2]);
plot(ax1, freq,V_86,'g', freq,V_89,'k', freq,V_91,'m',freq,V_92,'c',freq,V_95,'b','LineWidth',2)
legend(ax1, 'FVF = 0.86','FVF = 0.89','FVF = 0.91','FVF = 0.92','FVF = 0.95');
xlabel(ax1,'Frequency [Hz]');
ylabel(ax1,'|Voltage FRF| [V/g]');
Lv = (freq>=45) & (freq<=52);
plot(ax2, freq(Lv),V_86(Lv),'g', freq(Lv),V_89(Lv),'k', freq(Lv),V_91(Lv),'m',freq(Lv),V_92(Lv),'c',freq(Lv),V_95(Lv),'b','LineWidth',2)
ax2.XTickLabel = [];
ax2.YTickLabel = [];
annotation('arrow',[0.37 0.56], [0.8 0.8])
Produces This Plot —
Experiment with my code to get different results.
12 commentaires
Star Strider
le 3 Sep 2020
Experiment with the Position limits:
ax2 = axes('Position',[0.25 0.65 0.15 0.20]);
Remember that they are respectively [left bottom width height]. If you want to increase the width, increase elment 3, perhaps:
ax2 = axes('Position',[0.25 0.65 0.20 0.20]);
I did not test that to see what it looked like. It may also be necessary to adjust the annotation arrow.
Plus de réponses (2)
Bjorn Gustavsson
le 29 Août 2020
My prefered tool for this is: on-figure-magnifier - at the moment, my preferences vary since you can find a range of similar tools if you search for "magnify" on the file exchange.
HTH
0 commentaires
Image Analyst
le 29 Août 2020
See my demos that allow you to put insets of images or plots into other images or plots. When you plot the inset, change xlim and ylim to zoom in on the part your want to enlarge.
Voir également
Catégories
En savoir plus sur Axes Appearance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!