Example Code

Graphing 3D XYZ Scatter Plots and Lines

Code and Documents



This VI demonstrates how to plot a set XYZ values as a set of points on the 3D graph. It also shows how to plot a start point and end point and have those two connected by a line in a 3D graph using 3D graph library




In this VI you Set the number of plots on a graph, you specify the points coordinates and the plot style and it will draw the plot object relatively to the configuration. However you must convert OLE Color to match the RGB ordering in the hexadecimal notation otherwise the Blue and Red colors will be inverted. 

Whenever additional plots are added to the graph, they must have a style associated with them. Since this VI plots points and lines, there only needs to be two different styles. Three different styles were used simply to illustrate that each plot can have its own associated options. These properties are found by right clicking the graph on the front panel and selecting CWGraph3D»Properties and then selecting the Plots tab.




LabVIEW  2012 (or compatible)



Steps to Implement or Execute Code

1. Open the VI "Points and Lines 3D Plotting_LV2012_NI Verified"

2. Set the Points coordinates
3. Set the lines start and end points
4. Run the VI
5. Right click the graph >> Properties to modify the display style and plot-associated options



Additional Information or References





**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Todd S.
NI Employee (retired)

Thanks for posting! Please add a screenshot when you can!

Todd S.
LabVIEW Community Manager
National Instruments

This may be really obvious to some, but how do you create the CWGraph3D object that you connect as the input to the Set Plots VI in the block diagram? I mean: in what menu (or palette) is this?


Can i stream real time data into this 3D graph? in case the answer is yes could you give me some advice on how to do this?


Its incredible how incoherent and overcomplicated are the 3D graphs in labview.

There should be no different 3d graph objects for scatter plot and line plot.

There should be 1 3D graph object type, and a proper way of setting the plot parameters (line, points and line, points only, etc..).


It is ridiculous that you have to make so much messing around to plot your data in 3D with points and lines.