How to remove connecting lines in the line plot for large dataset?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Anshul Choubey
le 27 Jan 2022
Commenté : Anshul Choubey
le 28 Jan 2022
I have a Raman spectroscopy data for an area of 400x400 micrometer. The data is in the form of table. The table consits of coordiantes X,Y, Wavenumber and Normalized Intensity . The table is (319,725 by 4 )matrix. X&Y represents the coordinates. Normalized Intensity and Wavenumber corresponds to one coordinate. For each coordiante, there are 1015 values of Wavenumber and Normalized Intensity.
I wanted to plot a line graph between normalized Raman intensity and wavenumber and I get a connecting line in the graph.
Is it possible to remove the line in the graph?
clear all
Raman_data=readtable("Raman_Data_New.xlsx")
Raman_data_new=Raman_data(:,{'Wavenumber','Intensity'})
W=Raman_data_new(:,"Wavenumber");
I=Raman_data_new(:,"Intensity");
plot(W{1:3029,"Wavenumber"},I{1:3029,"Intensity"})
grid on
title('Raman Intensity vs Wavenumber')
xlabel('Wavenumber /cm')
ylabel('Normalized Raman Intensity')
histogram(I{:,"Intensity"})
histogram2(W{:,"Wavenumber"},I{:,"Intensity"})
2 commentaires
Benjamin Thompson
le 27 Jan 2022
Where is Raman_data defined? Can you post something that defines this variable?
Réponse acceptée
Ankit
le 27 Jan 2022
Modifié(e) : Ankit
le 27 Jan 2022
You can use unique to resolve this problem.
unique(A) for the array A returns the same values as in A but with no repetitions.
x = [600 650 700 750 800 850 900 950 1000 1050 1100 1150 1200 1250 1300 1350 1400 1450 1500 1550 1600 1650 1700 1750 1800 600 650 700 750 800];
y = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 2 3];
[~,idx] = unique(x);
x_new = x(idx);
y_new = y(idx);
plot(x,y,'r');hold on;plot(x_new,y_new,'-.b');
6 commentaires
Ankit
le 28 Jan 2022
tSplitPoint = min(Raman_data(:,3));
idxChange = find(Raman_data(:,3)<=tSplitPoint);
idxnew = [idxChange;length(Raman_data(:,3))];
xstart = 1;
for i = 1:length(idxnew)
plot(Raman_data(xstart:idxnew(i,1),3),Raman_data(xstart:idxnew(i,1),4),'r');hold on
xstart = idxnew(i,1)+1;
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots 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!