LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Multiple X axes in XY Graph

I have two vectors that are different lengths (due to an effective difference in sapling rate). However, they cover the same amount of time. I want to plot them on the same XY-Graph (overlay) but I want them to be aligned by time, not points. How can I use the existing x-axis (to be displayed) but plot the second graph using a different x-axis(not displayed) so they line up dispite having a different number of points?

Thanks
0 Kudos
Message 1 of 6
(4,373 Views)
Depending on what version of LV you are using and the req of the app you are developing, this could be easy or hard.

In LV 6.X you can simply right click on the max value of your X-scale and choose "duplicate scale". This will give you the ability to associate your plost with scales formatted the way you require.

Otherwise you can modify the data for the "under sampled" channel be inserting enough "NaN"s in the right places so that the two sets of data have the same number of values.

Does any of this sound right?

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 6
(4,373 Views)
As long as both signals are being captured at fixed rates, you don't need multiple X axis. Simply convert the X-axis increment from points to time and the plots will fall correctly in relation to one another.

For example, say Trace A is sampled at a 1000Hz rate. Multiplying the point number by the reciprocal of the sample rate gives you an x axis that is scaled in time--in this case, 1 msec between samples. Now if Trace B is sampled at a 2000Hz rate, the same calculations will result in an x-axis with 0.5 msec between samples. Because the scale is the same for both traces (relative time since the start of the scan) they can both be shown on the same axis.

The number of points in the two plots are totally immaterial.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 6
(4,373 Views)
This approach will only work if the faster rate is an integer multiple of the slower one.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 6
(4,373 Views)
Yep,

that approach just did not occur to me.

I stand corrected.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 6
(4,373 Views)
> I have two vectors that are different lengths (due to an effective
> difference in sapling rate). However, they cover the same amount of
> time. I want to plot them on the same XY-Graph (overlay) but I want
> them to be aligned by time, not points. How can I use the existing
> x-axis (to be displayed) but plot the second graph using a different
> x-axis(not displayed) so they line up dispite having a different
> number of points?
>

The other responses hopefully have you on your way, but in case they
don't, here is a quick overview.

If you have a recent version of LV, duplicate the X scale, using the
plot legend, choose a different X Scale for each plot. Set the X Scales
the interactively or via property nodes. The popup to hide the scale
that you d
on't want.

If you are using an antique LV, then you need to change your data to
match the scale that is there. Depending on the graph you are using
several techniques are available.

You mention an XY graph, the most general and probably the easiest in
this case. Apply a linear transform to each plot's X data to move it
from points to time. In otherwords, mutiply the X index by the dT and
add T0 so that they are plotted against time. Then set the X Scale
formatting to be Absolute time.

This can also be done with a waveform graph since you can make a
datatype that allows each plot to have its own clustered X0 and dX, but
this will only work if the points are evenly sampled within the plot.
If you want to use this, make the datatype be an array of cluster of X0,
dX, Y array. Each of the outer array elements can be given its own
value and the graph will do the linear transform for you. Again,
setting the X scale to show either time or relative time is probably
appropr
iate.

Greg McKaskle
0 Kudos
Message 6 of 6
(4,373 Views)