LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing line with y=0 origin on XY graph

I am trying to get rid of a line that appears on my XY graph (see attachment).  for additive scans, it disappears after the first scanHowever, for tuning purposes it is useful to have a non-additive scan (i.e. fresh y-data, rather than added to the array containing previous scans).  I cannot for the life of me figure out how to get this 'tail' off of the graphIt looks like a roll of thread fixed at y=0 and it unspools as the XY data is presentedAny ideas?
0 Kudos
Message 1 of 14
(4,462 Views)

You probably have one or more points of 0,0 at the end of your arrays.  How are you building up your data arrays?

 

I'm not sure what you mean by "additive" scans.

0 Kudos
Message 2 of 14
(4,461 Views)
well, this effect starts immediately. I initialized the arrays to 0, so there is no leftover data. for additive scans I mean that X goes from 0 to 1.5 repeatedly, while each y value is added to the y value present on the array from that x position on the last scan. (1,5) and (1,13) become (1,18).
0 Kudos
Message 3 of 14
(4,453 Views)
Are the arrays initializes 0 of a size that is larger than your first set of data?  Are you using replace array subset to replace zeroes with actual data?
0 Kudos
Message 4 of 14
(4,448 Views)
Instead of initializing with 0, initialize with NaN.
0 Kudos
Message 5 of 14
(4,440 Views)
I tried initializing with NaN, but it behaved oddly.  The x-axis was autosizing as if it was collecting data, but only the first point was shown on the graph.  As for Ravens Fan's questions, the size of the array is set based on the #iterations in the for loop (which is based on user input).  I am using replace array subset.  However, I think neither of these are an issue because it happens on the very first pass, right from array (0,0).  If I set the graph in aquisition mode (i.e. additive Y, while scanning X) the line disappears after the first pass.  However, when on scan mode (data cleared after each pass) the line is there on each new pass.
0 Kudos
Message 6 of 14
(4,425 Views)

I still think you have an extra data point in there, perhaps only on that first pass like you said.  Altenbach's suggestion of Nan is a good one as it causes not yet defined points to not be plotted.  If you have problems with autoscaling, then you should just turn off autoscaling.  Control the scales programmatically if you want to.

 

It is difficult to help you unless you post your VI so we can see what is going on behind the front panel.Smiley Wink

0 Kudos
Message 7 of 14
(4,418 Views)

A Note to anyone who comes after me.

When plotting an array and each row is an independent channel of data, and of different length, when its coverted to an array of signals, the signals must all be of equal length. So the maximum length is chosen, and then zeros are filled in, thus the line.

 

Said another way,

You will get the line to the origin even if your X data is the same length as your Y data, in each specific row of an array. The length of all rows must match to not get the line.

 

My solution was to cut off the trailing data on my longer signals.

0 Kudos
Message 8 of 14
(3,962 Views)

Hi PickPack,

 

when you create your plots as array of cluster of X-data&Y-data you don't need to cut-off any samples!

We still talk about XY grpahs here, do we?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 14
(3,957 Views)

I didn't say anything about clusters?

 

If your data is

 

X

0,1,2,3,4

0,1,2,0,0

 

Y

0,1,4,6,7

0,10,20,0,0

 

You must either do something different with the zeros or cut off the 3,4 position in the first signal.

If, like in my case, the trailing data is useless, ya might as well cut it off.

 

It just a different way of looking at the problem, for my particular use case.

 

And ya, some of us are relearning labview for the first second time, so why not talk about XY grpahs if I didn't find response that clearly illustrated what my issue was?

 

Good day sir.

0 Kudos
Message 10 of 14
(3,954 Views)