LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a reciprocal axis to an xy-graph?

Solved!
Go to solution

Dear freaks,

 

I am sure some of you are dealing with spectra from time to time. Especially in the field of infrared / nearinfrared spectroscopy it's quite common to work both with wavelength (nm) and wavenumbers (cm^-1). While displaying spectra in an xy-graph, I'd like to have two abscissae, one showing the wavelength, the other the wavenumber. Wavenumber / cm^-1 = 10^7 x wavelength / nm.

 

Any idea how to create that second axis? I guess it could be done using a picture control. Any better idea? How about designing an X-control?

 

See the attached screenshot. The second axis shown there was simply generated by allocating the reciprocals of the extrema of the first axis to the extrema of the second axis. In between the extrema the second axis is still divided linearly. This is not correct, of course, due to the reciprocal relationship between wavenumber and wavelength. Rather each tick on the first axis must be converted to a tick on the second axis using the formula for interconversion given above.

 

I am afraid my description of the problem sounds rather weird. However, I am convinced that the problem is of quite general interest.

 

Curiously waiting,

Peter

0 Kudos
Message 1 of 6
(3,560 Views)

@stoeckel wrote:

However, I am convinced that the problem is of quite general interest.



I agree. 😉

 

(however, with only ~10 kudos/year the outlook is bleak :()

0 Kudos
Message 2 of 6
(3,546 Views)

I've had to do something like this before and it frustrated me quite a lot.  Unfortuantely, it looks like a lot of peope have had the same problem.

 

This is what I ended up doing:  Don't try to do it using a scale.  Instead, create a number of numeric indicators that show the wavenumber (or other non-linear values) you would like to display.

 

Use the "Map Coords to XY" invoke node to read numbers from the graph, convert them to a position on the front panel and then use the numeric indicator's property node to place it at that positon.

 

Not a pretty solution, to be sure.

0 Kudos
Message 3 of 6
(3,543 Views)

Here's my solution.  I hope someone comes up with something better.

 

In this solution, the spacing of the indicators along the top is uniform, but their values are non-linear.  You could easily change this to have uniform numbers at non-uniform positons.

 

(And, of course I meant to say map XY to Cooridinates, not the other way around)

 

 

0 Kudos
Message 4 of 6
(3,541 Views)
Solution
Accepted by stoeckel

this one is  a little nicer in that it uses an array for the reciprocal scale, which makes it easier to set how many values you want on the wavenumber axis.

 

Also, it sets the horizontal and vertical position of the scale, so you can move the graph anywhere on the screen and the markers will follow.

Message 5 of 6
(3,533 Views)

Excellent solution! I would have given more than one kudo if it were possible. Thanks!

0 Kudos
Message 6 of 6
(3,514 Views)