How to remove connecting lines in the line plot for large dataset?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Anshul Choubey
el 27 de En. de 2022
Comentada: Anshul Choubey
el 28 de En. de 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 comentarios
Benjamin Thompson
el 27 de En. de 2022
Where is Raman_data defined? Can you post something that defines this variable?
Respuesta aceptada
Ankit
el 27 de En. de 2022
Editada: Ankit
el 27 de En. de 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 comentarios
Ankit
el 28 de En. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!