I have some wavelength data [which comes in units of nanometres] and want to plot it in units of electronvolts.
Specifically, I want two x-axes on my XY-Graph, the bottom one in units of eV (increasing from left to right) and the top one in units of nm (therefor decreasing from left to right).
I can not for the life of me get the top axes to show the correct scaling. Whatever I make the bottom axis is displayed correctly, but then I have to calculate what exactly the top axis scale looks like. I do this and set it with the Offset and Multiplier property, but it doesn't work.
Please see the attached picture and vi.
The picture shows some mock data with a correct bottom x-axis (in eV) but wrong top x-axis (in nm; should be about 730 to 520 from left to right).
Please note that here I use the (very good) approximation to convert nm to eV : [eV] = 1240/[nm]
sorry i can not edit my above post. here's a block diagram snippet of the attached vi..
Please don't call it a "snippet" when you attach a simple image! Snippets are some special kind of image with respect to LabVIEW…
On your problem: have you tried to set the XAxis.Range property? It allows to set the increment between the min/max of the range: you also need to change it according to your scaling factor!
(For a quick improvement it might help to hide the grid lines for that 2nd X axis…)
Btw. this LinSpace VI can be replaced a simple Ramp function call. (It comes with LabVIEW and is [more] bug-free than your VI: when I request N points "including the endpoint" then I don't want to get N+1 points…)
FYI to create an actual snippet, highlight the code you want to copy (in your case, all of it) then click Edit -> Create VI Snippet from selection. Upload that, and it'll actually contain the code within it and we can just drop it into LabVIEW on our end. Using that trick gives it some voodoo magic to contain actual LV code within an image.
Thank you for your feedback, @GerdW and @BertMcMahan, I have incorporated your suggestions. Ultimately what helped was first plotting the data on the bottom x-axis, then grabbing the scale bounds from that, convert these bounds back to nm, and finally apply them to the top axes (in reverse order, i.e. eV_min becomes nm_max etc.)