How can I add a zoom in the peak of the curve ?
조회 수: 102 (최근 30일)
이전 댓글 표시
Hi
How can I add a zoom in the peak of the curve like the attached one ?
댓글 수: 0
채택된 답변
Star Strider
2020년 8월 29일
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
Star Strider
2020년 9월 3일
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.
추가 답변 (2개)
Bjorn Gustavsson
2020년 8월 29일
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
Image Analyst
2020년 8월 29일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Axes Appearance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!