LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Spectromètre: graphe multicouleurs / Spectrometer: multicolor graph

Bonjour,

 

Je cherche une solution à un problème somme toute simple.

J'acquiers des données avec un petit spectromètre. J'aimerais que ma courbe soit en couleur dégradée du violet au rouge et non unie (ce qui serait fort élégant et pratique pour présenter un spectre luminuex Smiley Wink

Je vois bien que sur les forums dessiner une courbe multicouleur est une question récurrente mais sans solution pour le moment.

Est_ce que quelqu'un auait une idée, même non élégante?

 

Bien cordialement.

 

 

 

Hi,

 

I would like to plot a curve returned by a spectrometer where the color is a function of the X data (spectrum): Violet color for the beginning of the graph, red for the end and all the color between.

I know that this represent an issue but I hope to meet some clever users here!

Best regards.

 

0 Kudos
Message 1 of 4
(2,744 Views)

Hi CIML,

 

you could use a picture indicator and draw your points with any color you want.

Yes, it involves some math and color coding, but it's a solution 🙂

 

And do some searching here in the forum, there were other people also doing "color" plots of spectra before you...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,732 Views)

La solution la plus simple est de mettre une image dans l'arrière plan du graphe avec la propriété PlotImages.back

L'image doit être ta rampe de couleur en fonction de X.

Ensuite tu traces ta courbe avec un remplissage jusqu'à +infini.

Ca n'est donc pas la courbe qui est colorée, mais l'aire sous la courbe.

 

Pour avoir uniquement une ligne tu peux ajouter une deuxième courbe plus basse avec un remplissage jusqu'à -infini. S'il n'y a pas de grosses variations de Y par rapport à X un simple offset peu suffire. Sinon il faut quelque chose de plus intelligent pour conserver une largeur de trait constante.

-----------------------------------

The easiest solution is to put a picture in the background of the graph by using the PlotImages.back property.

The picture needs to be your color function of X.

Then plot your data with a fill to +infinity.

You won't get a colored curve but a colored area under the curve.

 

In order to get a colored curve you can add a second curve slightly lower and filled to -infinity. If there's no big variation of Y agains X a simple offset can be enough. Otherwise you'll need something more clever to keep a constant line width.

 

 graphs.PNG

Message 3 of 4
(2,709 Views)

Hello,

 

I'm sorry but I could not solve the problem with this solution.

I tried a solution according to this website: http://edgeffects.blogspot.fr/2012/05/visible-light-spectrum-to-rgb.html

I created a matrix (color table) of values (3 columns for RGB respectively) according the the formulas.

Now, I want to plot my XY spectrum  (X is the wavelength, Y the intensity and Z the color, according to the color table corresponding to the wavelength).

I.e. the plot will be violet @400nm, Blue @ 500, Orange @ 560nm, etc.

 

Thanks for your help.

Sébastien

 

0 Kudos
Message 4 of 4
(2,605 Views)