LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Graph - overlaying linear/log scale data

Solved!
Go to solution

Hi folks,

 

I'm in LabVIEW 2012 and I have an (x,y) dataset that I want to plot on a set of primary axes. I also want to overlay a second horizontal axis showing the same data, but using a set of scaled units (xStar). You can look at the attached VIs to see how x transforms into xStar, but it's basically the quadratic formula with an exponential thrown in. The x-values are plotted on a linear scale, but, because of that exponential transformation xStar-values are plotted on a logarithmic scale (see image).

 

I want these two plots--(x,y) and (xStar,y)--to overlap exactly so they're effectively a single plot. That way, given any (x,y) point, I can quickly read off the corresponding xStar value by looking at the secondary axis scale. x and xStar are both physically useful parameters, so it helps to be able to read either one off the graph depending on the situation.

 

Any suggestions on how to get these two plots to overlap? Currently, I'm using the min/max x-values to generate the appropriate min/max xStar-values, which makes the plots agree at the endpoints (but not in between). Do I also need to specify the graph scale increments somehow? If so, what's a good method to accomplish this?

 

Linear-Log Overlay.PNG

 

Thanks!

0 Kudos
Message 1 of 9
(5,018 Views)

Update:

 

Found an answer here with regards to other non-linear scalings (e.g., reciprocals/wavenumbers).

 

http://forums.ni.com/t5/LabVIEW/How-to-add-a-reciprocal-axis-to-an-xy-graph/td-p/1775966

 

So my takeaway is that the overlay I want to accomplish is not currently supported through XY Graph properties, but a solution can be kludged together by overlaying other indicators on top of the XY Graph.

 

Anyone have information otherwise?

0 Kudos
Message 2 of 9
(4,983 Views)
0 Kudos
Message 3 of 9
(4,957 Views)

DonhJoe--your URL takes me to a dead-end page.  Could you check the hyperlink?

0 Kudos
Message 4 of 9
(4,949 Views)

Try  http://forums.ni.com/t5/LabVIEW/multiple-y-axis-xy-graph/td-p/1692762

 

Sometimes copying and pasting links throw in extra characters which mess it up.  In this case a %A0 that is unprintable when looking at the link on the webpage, so you don't even see it.  Sometimes the links may grab onto a period at the end of a sentence and mess it up as well.

0 Kudos
Message 5 of 9
(4,932 Views)

Thanks RavensFan; I didn't even think to just copy-paste the URL text rather than rely on the hyperlink!

 

The link in question seems to be about adding multiple Y-scales on a graph, which is a slightly different issue.  I definitely know how to add multiple X- and Y-scales, as is clear from my posted VI and images.  The heart of my question is this: given two data scales (x and xStar) that are related by some known transformation, how can I make the data plotted on each scale line up exactly?  I believe the XY Graph handles linear transformations easily, but cannot handle general transformations.

 

Judging by this post from 2009 (http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Custom-Axis-Mapping/idi-p/1034026), it sounds like there's a contingent of LabVIEW users who would love this feature, but it's probably not on the top of the list for implementation?

0 Kudos
Message 6 of 9
(4,924 Views)
Solution
Accepted by topic author hwilterdink

The nonlinear (nonlog) relation is between x and xStar, you choosed a log-scale grid, so I assume the 'linear' scale should be adjusted. 

Since the relatiion x -> xStar is given and fixed for a scale, you can create a picture on top of the graph with the picture tools.

read the log scale min and max, read the x pixel length of the plot area  and whenever the scale is changed (event) recalculate and draw the 'lin' scale.

-draw the minor ticks  , draw the major ticks and numbers.

 

I would simply use one scale, add a cursor, lock it to the plot and use the cusor change even (read pointindex, get x,y from data) to display x,xStar and y

 

I posted an vi accidently in this old thread 🙂

http://forums.ni.com/t5/LabVIEW/How-do-you-create-a-gauge-with-a-non-linear-non-log-scale/m-p/331073...

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 7 of 9
(4,897 Views)

Henrik,

 

I like your take on my problem using the cursor; thanks for the example code.  I will play with my options over the next week and let you know how it goes.

0 Kudos
Message 8 of 9
(4,866 Views)

Henrik,

 

I'm accepting your suggested cursor method as a solution.  It's pretty straightforward to handle, and is also more scaleable.

 

For my dataset I realized there is another parameter I can calculate (xDoubleStar?) that is useful for users to access.  If I tried to display all my parameters (x, y, xStar, xDoubleStar) on graph axes, things would get very muddled very quickly.  In comparison, your cursor method, is very scalable for this purpose.  I can drop the cursor on a certain (x,y) point, and then I can display any information relevant to that point next to the XY Graph.

 

Thanks for the help!

0 Kudos
Message 9 of 9
(4,789 Views)