I have a data with wavelength and intensity and I draw these graph with excel.wavelength- intensity graph

then how can i make this into specturm like below?spectrum

  • $\begingroup$ You can use How to plot an emission spectrum? But I suppose you are interested in a profile not in a set of lines, right? $\endgroup$
    – Kuba
    May 9 '17 at 12:20
  • $\begingroup$ Can you provide sample data? $\endgroup$
    – Szabolcs
    May 9 '17 at 12:41
  • $\begingroup$ my raw data is in my spread sheet : docs.google.com/spreadsheets/d/… $\endgroup$
    – SY Lee
    May 9 '17 at 13:21
  • $\begingroup$ You might consider using FindPeaks along with any of the solutions in the thread Kuba linked to. I'm marking this as a dupe; if you think the code there doesn't solve your problem, edit this question to explain why. $\endgroup$ May 17 '17 at 12:25

Here's an example with some generated sample data. You will need to adjust the colour function and the scaling of the data for your application. Here I used the builtin colour function ColorData["VisibleSpectrum"], which takes values between 380 and 750. You probably need to tweak this, since your range is 300 to 1000.

Sample data:

data = Table[{x, 
    Sum[Exp[-0.1 (x - mid)^2]/mid, {mid, {400, 500, 600}}]}, {x, 380, 

ListLinePlot[data, PlotRange -> All]

Mathematica graphics

Rescale data, so intensities are between 0 and 1.

max = Max[data[[All, 2]]];
data = {#1, #2/max} & @@@ data;

Build a nice colour function:

cf = Blend[{Black, Blend[{White, ColorData["VisibleSpectrum"][#1]}]}, #2] &;

This has two parameters: the first one is the wavelength, the second is the intensity. The extra blending with White is to improve visibility.

ArrayPlot[{cf @@@ data}, AspectRatio -> 1/10, 
 PlotRangePadding -> None]

enter image description here


Not the answer you're looking for? Browse other questions tagged or ask your own question.