labeling data sections on a graph
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I would like to add a label including each set of peaks in the graphs below (4 labels per graph).
this was my code.
load 'HCl_DCl_Complete'
ds=table2array(HCl_DCl_Complete);
wn=ds(:,1);
Trans=ds(:,2);
Abs= -log10(Trans/100);
subplot(2,1,1);
plot (wn, Abs, 'r-');
xlabel('Wavenumber $$\tilde{\nu} (cm^{-1})$$', 'Interpreter','latex')
ylabel('Absorbance')
title('In terms of Absorbance')
subplot(2,1,2);
plot (wn, Trans, 'k-');
xlabel('Wavenumber $$\tilde{\nu} (cm^{-1})$$', 'Interpreter','latex')
ylabel('Transmittance')
title('In terms of Transmittance')
%those are the labels I would like to add.
txt={'Fundamental DCl', 'Fundamental HCl', '1st Overtone DCl', '1st Overtone HCl'};
%I have tried it with this interval but it did not work.
text(wn(29120:end), Trans(29120:end), txt)
sgtitle('The IR spectrum of HCl and DCl')

0 Kommentare
Antworten (1)
DGM
am 12 Nov. 2021
Consider the example:
[x,~,z] = peaks(100);
x = x(1,:);
z = z(50,:);
plot(x,z)
labels = {'dip 1','bump 1','bump 2'};
text([-1.1 -0.5 1.5],[-2.75 2.1 3.6],labels)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Axis Labels 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!
