another crazy plot layout with zoomed portions and arrows
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
HC98
am 15 Jun. 2023
Bearbeitet: Les Beckham
am 15 Jun. 2023
Hi, so I'm writing some lecture notes and want to show how to do this
For our purposes let's just suppose 'f(x) = exp(-x)'
0 Kommentare
Akzeptierte Antwort
Les Beckham
am 15 Jun. 2023
Bearbeitet: Les Beckham
am 15 Jun. 2023
Hopefully you can adapt this approach to your needs.
x = linspace(0, 10, 1000);
y = exp(-x);
plot(x, y)
grid on
ax = axes('Position', [0.3 0.6 0.1 0.2], 'Units', 'Normalized', 'Box', 'on', 'XGrid', 'on', 'YGrid', 'on');
idx = (x >= 1) & (x <= 2);
line(ax, x(idx), y(idx))
xlim([1 2])
% arrow ending coordinates were determined by trial and error since they are normalized
% to the entire figure rather than the axes
annotation('arrow', [0.3 0.25], [0.6 0.3])
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!