How to remove connecting lines in the line plot for large dataset?
조회 수: 3 (최근 30일)
이전 댓글 표시
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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/875805/image.jpeg)
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
Benjamin Thompson
2022년 1월 27일
Where is Raman_data defined? Can you post something that defines this variable?
채택된 답변
Ankit
2022년 1월 27일
편집: Ankit
2022년 1월 27일
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
Ankit
2022년 1월 28일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!