How to remove connecting lines in the line plot for large dataset?

6 ビュー (過去 30 日間)
Anshul Choubey
Anshul Choubey 2022 年 1 月 27 日
コメント済み: Anshul Choubey 2022 年 1 月 28 日
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 件のコメント
Benjamin Thompson
Benjamin Thompson 2022 年 1 月 27 日
Where is Raman_data defined? Can you post something that defines this variable?
Anshul Choubey
Anshul Choubey 2022 年 1 月 27 日
I have included the excel file in the attachment. The data looks like this.

サインインしてコメントする。

採用された回答

Ankit
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
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
Anshul Choubey
Anshul Choubey 2022 年 1 月 28 日
Thank you for the answer and the help. It saved a lot of time for my project.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by