06-22-2017 10:59 AM
Sorry for the awkward phrasing of the question, I'm not sure what to call it.
Basically, I want to plot multiple data sets on the same XY graph (so they can be compared to each other). I want the points of a given data set to be connected by lines (as the XY graph does by default), but I don't want a line to connect them to the following data set (that is, if I pass it data set 1 and then data set 2 a little later, I don't want a line connecting the last point of data set 1 to connect to the first point of data set 2).
For example:
produces
because it's resetting every time by default, I believe. If I make it not reset:
all the data sets remain plotted (like I want), but you get that undesirable line I was talking about:
So what can I do? I don't know if I should use the express XY graph thing in this situation.
If I had to make a wild guess as to a solution, I could do something like, just do the 2nd thing I did, but in between data sets, set a property of the plot style (like the line color or width) such that the connecting line (between data sets) just isn't visible.
However there's probably a smarter way. Can anyone help me? thank you.
Solved! Go to Solution.
06-22-2017 11:16 AM
You can have multiple plots. Instead of using the express VI, you are going to use the XY graph property nodes to select which plots you will be drawing to.
This snippet gives you a rough idea of what needs to be done.
06-22-2017 11:50 AM
You have two options:
1. Get rid of the express vi and use regular LabVIEW code to graph multiple plots.
2. Use a single plot and insert a NaN value whenever you want a gap.
06-22-2017 12:52 PM - edited 06-22-2017 12:57 PM
@altenbach wrote:
2. Use a single plot and insert a NaN value whenever you want a gap.
Here's a quick example for that. (I assume that you want to possibly update the graph after each trace (e.g. if the loop involves acquisition. A).
If you just want to do all traces at once, use a concatenating tunnel instead of a shift register. (B)
06-22-2017 01:11 PM
Hi, thanks for the tip.
So I tried doing this, but I'm getting a kind of vague error:
It seems like I'm doing the same thing as in your example, giving the active plot number and then the bundle of arrays... but for some reason it doesn't work...
I see the difference that you're doing both plots 0 and 1 at the same time whereas mine is doing it one at a time, but I still don't really get why it isn't working.
06-22-2017 01:22 PM - edited 06-22-2017 01:26 PM
@optoelectro wrote:
I see the difference that you're doing both plots 0 and 1 at the same time whereas mine is doing it one at a time, but I still don't really get why it isn't working.
Use my method, it is much cleaner. You typically cannot write to a plot via property node unless that plot already exists. Writing to a plot property also does not adapt the plot automatically to the datatype. I think the "value" is for all plots. I doubt you can select it via "active plot".
... and please attach VIs instead of images. We cannot tell the exact datatype from an image/
06-22-2017 01:24 PM - edited 06-22-2017 01:31 PM
You need to use the Build cluster block (not the index and bundle or any other block). The x array should be the first object of the cluster, and the y array should be the second.
06-22-2017 02:52 PM
@altenbach wrote:
@optoelectro wrote:
I see the difference that you're doing both plots 0 and 1 at the same time whereas mine is doing it one at a time, but I still don't really get why it isn't working.
Use my method, it is much cleaner. You typically cannot write to a plot via property node unless that plot already exists. Writing to a plot property also does not adapt the plot automatically to the datatype. I think the "value" is for all plots. I doubt you can select it via "active plot".
... and please attach VIs instead of images. We cannot tell the exact datatype from an image/
Wow - you're right about the value. I think I had a power glitch to my brain.
06-23-2017 02:00 PM
thank you, this worked!
I still kind of can't believe there's not a more native way to do this in labview (your solution is great but definitely a "workaround"), but thank you!
06-23-2017 02:07 PM
No, it's the right and native way, not a workaround. Anything else would need much more complicated data structures to maintain information on which points of a plot should be interpolated with a line.