Showing results for 
Search instead for 
Did you mean: 

How to display spectral lines in color band


I want to display a line spectrum in color band format.  What I have are two arrays: wavelength and intensity. I can plot the graph like the bottom one and I want to convert it to the top color band. The considerations are:


1. the color must agree with the wavelength.  For instant, the 650 nm corresponds to the red color and the 490 matches the blue

2. the line intensity is indicated by the line width of the color line.  For instant, the 650 nm line is a strong one and its red line in the color band is the widest.   The 435 nm line is a weak one so it is barely see (but still visible) in the color band.


I would like to know if labview has any built-in function to assist me with this job.  If not, any idea of implementing this?


Thanks in advance for any suggesting.




0 Kudos
Message 1 of 22

i dont think there's labview support on this...the easiest way would be to code it yourself, by drawing an image and using color-code your rectangles, you will have to specify some sampling points (400nm-->blue, 540nm-->green...) and to interpolate between them...the more sampling points you have, as better the color matching...

Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 2 of 22

I am thinking of an alternative way to implement this, but not sure if LabView can handle:


1. First, set a standard color spectrum as background:



2. Then, make the spectral line image as 2D, and put it in front of the color spectrum with the wavelength aligned.  The picture below has the y-axis offset a bit to show my concept:



For the 2D spectral line image, I have the max intensity set as white and the min set at black.  WHAT IF I can set the min as "opaque" and max as "100% transparent"?  Is it possible?


I started my labview programming last year so sometime I may think labview can "fly".  If this concept is too crazy (a.k.a. impossible) , just let me know.  Thanks!


0 Kudos
Message 3 of 22

You can use the Picture functions. I would start with the shiped example .....\examples\picture\demos.llb\Histogram and modify it to fit your needs.

Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 22

Hello Coq, would you mind elaborate a bit more?  My understanding is to set the standard full spectrum as the background "picture" in the plot, but how to I convert the spectral line plot into a transparent one based on their intensity?  Or, are you suggesting another method to implement?  Thanks!

0 Kudos
Message 5 of 22

another possibility are user defined controls...for example, you can use an xy graph and use your spectrum as a background (right-click an xy-graph and chose advanced-->customize)


or: use the function "get image subset" in the picture palette to extract a part of your spectrum (or one spectral line...), then you can create an output picture depending on your picture...

Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 6 of 22
Message 7 of 22

yeah, thats what i meant :-)...didn't know that theres already an example...

Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 8 of 22

YES Intaris, your bottom plot is very close to what I need.


My original data is a 2D array which I usually plot like this:



My goal is to make it look like this:



Following the replies from this post, I am currently in a step of having this (this is another spectrum so the lines look different):



Can you give me hints on how to make your bottom plot?


Thanks everyone for their reply

0 Kudos
Message 9 of 22

I used a picture control to generate the images.


An important note is to ALWAYS create the picture from scratch (start with an empty picture) because if you keep drawing over the old one, performance gets really bad really quickly.


I'll post an example when I get back home, that's where my code is.





0 Kudos
Message 10 of 22