LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot points corresponding to a given pair of x,y values on a graph in real time?

Hi,
I have a value for say x and a value for say y after one real time measurement. I want to plot the x and y values against each other on a graph. Then i want to continue doing it ie. get another point for the next measurement and so on. I have tried doing this but the x-y graphs only allow me to plot one or multiple parameters against a time scale on the x-axis. Is it possible to have a different quantity on the x-axis and plot a set of y values against it?
Thanks,
Shyam.
0 Kudos
Message 1 of 15
(5,687 Views)
"Is it possible to have a different quantity on the x-axis and plot a set of y values against it?"

Do you mean a different quantity of x and y values? Or do you mean different quantity - other than timescale?

You can certainly plot y data versus any x data, regardless of its units (time, distance, voltage, etc.). The data must of course be in pairs - each y data point must have a corresponding x data point.

~Tim
0 Kudos
Message 2 of 15
(5,686 Views)
Hi Tim,
Yes, I mean different quantity other than time scale. What sort of plot do you use for that? I tried x-y graphs but the examples seem to show that you can put only the time scale on the x-axis.
Thanks,
Shyam.
0 Kudos
Message 3 of 15
(5,686 Views)
The x scale of the XY Graph can be anything. The default label is time but to change it, just use the text tool. The example XY Graph.vi doesn't use time on the X axis.
0 Kudos
Message 4 of 15
(5,685 Views)
Hi,
I figured out the way to use the x-y graph for plotting but i still dont get any points on the graph when i run the vi. I am attaching a simplified version of my problem.
Thanks,
Shyam.
0 Kudos
Message 5 of 15
(5,685 Views)
The reason you're not seeing anything plotted is that each time you go thru your loop you're plotting a single point and the plot style is lines / no point.

See the attached modified to plot a square marker at each point.

My guess is that you want to continue adding points so that the graph continues to 'build' with each iteration. In this case, you'll need to continually append data into your x and y arrays. Be careful about how you accomplish this as you can cause yourself memory problems. Look here for some advice on memory issues with respect to building arrays.

http://zone.ni.com/devzone/conceptd.nsf/webmain/732CEC772AA4FBE586256A37005541D3?opendocument#3

~Tim
0 Kudos
Message 6 of 15
(5,685 Views)
Hi Tim,
Sorry for replying so late. The code is working now. Thanks for the help.
Regards,
Shyam.
0 Kudos
Message 7 of 15
(5,685 Views)
Hi,

I am also going through similar difficults. I want to plot an x,y graph. In my experiment I colect two "independent" quantities, Resistance and Temperature, by independent I mean the way they are colected (by two different intruments). So I would like to make plots R versus T, continuosly. How should I procceed?

The example we have in this web site I see just one point "moving".

Thanks
Message 8 of 15
(5,685 Views)
I think you shuld look at the shipping example called XY Chart. It shows how to make an XY Graph increment like a chart - that is update the data as it's acquired. It shouldn't matter that you're using two different instruments. If you convert them to DBL and bundle them together, each new point can be wired to the subVI XY Chart Buffer input "new point".
0 Kudos
Message 9 of 15
(5,685 Views)
I am sorry. I looked and I still have some difficults. Could tell how make, for instance, a real-time plot of y = x*x + 4 ? That it to say given x and y how to bundle/array this values in order to use the XY graph.vi? I want for each x,y a dot in the screen and not generate all x,y and plot it.

I followed the example I have in my computer, the array is out of the loop or the is generated all at once.

As a suggestion, I think that in the next version of labview this kind of manipulation with array should be facilitated. However the way Labview is now is already very very nice.
0 Kudos
Message 10 of 15
(5,685 Views)