LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I overlay X Y Scatter plots that are generated at different times?

I have an experiment that runs for days. I generate several X-Y scatter plots that update periodically as new data is taken. The problem is after I run at (environmental condition 1) I generate a plot say (Power VS Current at Environmental condition 1).   Then I want to overlay (Power VS Current at Environmental Condition 2) , Environmental Condition 3 etc....

 

So the X-Y graph updates periodically, then the experiment restarts at a different envirnmental condition, and I want to overlay that on the existing X-Y scatter plot.

 

How do I do this, there has to be a way?

 

 

0 Kudos
Message 1 of 17
(3,976 Views)

I do this all the time in Excel and the general idea is you need to use elapsed time instead of absolute time (time stamp) as the X axis.

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 17
(3,951 Views)

That was absolutely no help whatsoever.

1)  I am programming a live experiment in labview.

2) The X Axis has to be Laser Current, TEC Current, Case Temp etc.... The Y values are things like Power, Mean Wavelength, FWHM etc....

3) As the experiment runs the graph is populated 1 point at a time, live, while its running, [1) Increment Current, 2) Take Data 3) Graph, 4) Repeat until finished]   ,   Increment environmental condition [1) Increment Current, 2) Take Data 3) Overlay on prior graph, 4) Repeat until finished]  , Increment environmental condition

 

 

When you are done you have 3 different X-Y scatter plots, generated 1 point at a time, overlayed.

 

 

If I want snazzy graphs after the fact for reports I use MATLAB.

0 Kudos
Message 3 of 17
(3,944 Views)

Can I "Un-Kudo" this?

0 Kudos
Message 4 of 17
(3,936 Views)

Basically, each new plot will be a new plot on the same x-y graph.  The general process will be a loop that selects the plot to write to, then writes the data to that plot.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 17
(3,934 Views)

I guess I missunderstood you

 

Then all you need to do is plot one then change the plot color and plot another one over the top of it.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 17
(3,929 Views)

The advantage of the way I suggested is that you end up with distinct plots.

 

The advantage of RTSLVU's way is that it's a lot easier!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 17
(3,924 Views)

Ok, BUt how do I keep from overwriting the initial plotted information. Are you saying I should set up the graph at the start with (for instance) 3 unpopulated x-y arrays, then slowly poplate them. I don't really know how many points are to be plotted. Some of it is time based so I have been growing the array at each data point.

0 Kudos
Message 8 of 17
(3,921 Views)

There are different things you should consider, but the main point is to take some more tutorials to deepen your knowledge in LabVIEW. Do you clearly understand how shift registers work for example? If the answer is no, I strongly advice you to look at the LV learning options/resources.

 

An XY Graph is an object in LV which will plot what you "throw" at it. Nothing more and nothing less. You can plot multiple curves too.

 

The other part of the story how you store the data in RAM of your long term ongoing measurement? If your code contains building data arrays in an unlimited way, it is called a memory leak. You need to limit the sizes of your arrays, and also decide what kind of logging/presenting technique you wanna use.

 

I can give you an example how I do it in one of my projects where I have experiments running for days:

 

  1. In the experiment I use 1Hz sample rate, and I have about 12 data channels (+ a channel for the absolute time stamps)
  2. When the user requests, I store the data in TDMS files (channels, absolute time stamps, and some other config info)
  3. I have a Functional Global Variable which acts as a limited memory buffer to store all data channels and time stamps in a cluster (with data arrays)
  4. In the project requirement it was only asked to store 2 days of data, means I limit the incrementally growing arrays: if the array sizes reach number 2 x 24 x 3600 = 172 800, I remove 3600 data points (1h of measurement) from the front of the arrays. In this way I do not have a memory leak.
  5. The user can any time plot any data channels as multiple curves, and even select the time interval which heshe is interested in to see
  6. If you have a monitor with pixel resolution of 1280x1024 for example, a Graph might have a size of 800x600 just for example. It does not make any sense to try to plot more than 800 data points per channel, since you can only see points max as many pixels you have. LabVIEW still can manage if you try to plot more points than the pixel size of the XY Graph, but it will need to do some "behind the curtain" decimation on the data. I like to have my own control on this, so when my user requests a new plot group, first I check how many data points were asked to plot: if this is larger than the horizontal pixel size of the Graph, I decimate the data (user can chose to decimate or average the data). Of course this can hide away important fine structure of curve trends, but the user can simply "magnify" into the interesting time interval until no more decimation is required.
  7. All data is logged into TDMS file, so there is another option to plot this data later either using LabVIEW or Excel, NI DIAdem, etc...

EDIT1: It can be also that you are confusing the Charts and XY Plots in LV: Charts have built-in memory (by default 1024 points per plot), XY Graphs do not have, they just plot what is connected to them.

Message 9 of 17
(3,898 Views)

I think that the x-y graph won't remember previous plots - as you've found out - so you have to remember each plot as an element of an array in a shift register.  I suppose you could us an Action Engine to accomplish this.

 

Edit:

I see Blokk has suggested something very similar, and expanded, too.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 10 of 17
(3,894 Views)