Plot XY Data from a 2D Array in LabVIEW

Updated Jul 1, 2020

Reported In

Software

  • LabVIEW

Issue Details

  • I have some x-y data in a 2D array that I'd like to plot in LabVIEW. What do I need to do to plot my data?
  • Whenever I connect an array wire directly to a XY Graph, I get an error telling me that I've connected two terminals of different types.

Solution

In order to plot x-y data in an XY graph, you will need to convert the data into a cluster of the X and Y array data. The snippet below will allow you to use an XY Graph to plot a 2D array in LabVIEW.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
  1. Start with your data in a two dimensional (2D) array
  2. Use the Index Array function to separate the array into two one-dimensional arrays -- one containing x data and one containing y data.
  3. Bundle into a cluster which is the expected input type of the XY Graph function.

Additional Information

Refer to the XY Graph Data Types VI in labview\examples\Controls and Indicators\Graphs and Charts\XY Graph for an example of graphing XY data.