LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display 4d data within a 3d scatter plot

Hi, I have looked through a number of posts and I am curious if there is a method that allows for control of the color for each 3d scatter plot symbol to provide a 4d display.

 

I have seen quite a few posts, many by Ben , that show that by using numerous plots within a 3d scatter plot, essentially binning the incoming W values ( assuming XYZW data ) , and then assigning unique colors for each binned range of 'W' values and then including all of these individual 'plots' within the 3d scatter display that would emulate a 4d display but I was hoping for something a little more elegant (read easier) that would allow me to individually assign colors to each XYZ point based on W values.

 

My current data sets contain more than 1 million points, and my understanding, based on reading thru the forums, is that the number of plots within a given 3d scatter display is limited to I16 range ( either 16K or 32K ). This prevents me from treating each data point as a 'plot' within the 3d scatter display and points me back to the binning method.

 

 

Any ideas ?

 

Thank you,

-- Sam

 

 

0 Kudos
Message 1 of 22
(13,136 Views)

Sam,

 

When using the 3d scatter plot, I have not found a way to easily/ elegantly base the color of each point on a 4th dimension. You can bind the color to a scale which works on any one dimension of the 3 dimensions xyz. 

 

There should be a way to utilize the 3d picture control to provide some sort of scatter plot functionality but this is likely not going to be a viable solution for most people. In other words, I am unsure what would happen if you implemented 1 million objects in a 3d picture control. 

 

<Joel Khan | Applications Engineering | National Instruments | Rice University BSEE> 


0 Kudos
Message 2 of 22
(13,117 Views)

@Joel Khan wrote:

Sam,

 

When using the 3d scatter plot, I have not found a way to easily/ elegantly base the color of each point on a 4th dimension. You can bind the color to a scale which works on any one dimension of the 3 dimensions xyz. 

 

There should be a way to utilize the 3d picture control to provide some sort of scatter plot functionality but this is likely not going to be a viable solution for most people. In other words, I am unsure what would happen if you implemented 1 million objects in a 3d picture control. 

 

<Joel Khan | Applications Engineering | National Instruments | Rice University BSEE> 


I can. Smiley Wink

 

Using the bare minumum, I can get about 15000 objects to plot, the first time, then clearling and replotting LV runs out of memory (that is with plenty of memory on a 32 bit machine)

 

I limited my display to 10,000 to keep LV from blowing up.

 

now using the CW 3D graph...

 

1) I don't think anyone could see 1M points on modern screens.

 

2) I think I ran into a 32K limit in a plot but I could use multiple plots.

 

the CW 3D graph would still try but modern PC can hardly handle changing the view with 1M points.

 

That's my two cents worth!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 22
(13,113 Views)

Thank you both for your inputs.

 

I did some experiments and what I ended up doing was decimating the data set by reducing a number of XYZ points to a single XYZ point using spatial discrimination ( user adjustable vector distance between XYZ dimensions ). This drastically reduced the number of 3D points. I then set up 128 'bins' for the 4th dimension data, W, and then sorted the XYZW data into 128 separate plots based on the 'bin' boundaries for the W values, generated a color table ( 128 values ) and assigned the colors to the 128 plots. Brute force method but it displays the XYZW data in a reasonable way.

 

I now have to implement a method to display 'slices' from this data using an arbitrary plane. Even if the plane was only in XY, or YZ, or XZ, that is parallel to one of the axes (and it is not), using the scatter plot with 128 plots and with a relatively large number of points in each plot, it is very slow to change an axis range to display a 'slice' of data.

 

-- Sam

 

 

0 Kudos
Message 4 of 22
(13,086 Views)

@SamRogers wrote:

Thank you both for your inputs.

 

I did some experiments and what I ended up doing was decimating the data set by reducing a number of XYZ points to a single XYZ point using spatial discrimination ( user adjustable vector distance between XYZ dimensions ). This drastically reduced the number of 3D points. I then set up 128 'bins' for the 4th dimension data, W, and then sorted the XYZW data into 128 separate plots based on the 'bin' boundaries for the W values, generated a color table ( 128 values ) and assigned the colors to the 128 plots. Brute force method but it displays the XYZW data in a reasonable way.

 

I now have to implement a method to display 'slices' from this data using an arbitrary plane. Even if the plane was only in XY, or YZ, or XZ, that is parallel to one of the axes (and it is not), using the scatter plot with 128 plots and with a relatively large number of points in each plot, it is very slow to change an axis range to display a 'slice' of data.

 

-- Sam

 

 


It sounds like you have a decent handle on the 3d graphs, Great! Could you post an image of your display? (I like 3d images). If you could post an example even better (but I will not hold my breath).

 

The arbitrary slicing thing is something I have never coded. My 3d Railraod code used a method to resample the arbitrarily spaced data as regularly spaced so re-sampling may be a first step toward your end.

 

I'd say more but, like I said, it sounds like you have the easy stuff figured.

 

Take care,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 22
(13,084 Views)

Ben,

I can't show any plot results without generating a dummy data set as the data I currently am using is proprietary. And the actual code I developed would be considered proprietary as well. Employment agreements....

 

I will say that once I decided to break up the data in the manner I described, the coding only took about two hours to develop and debug as it is very straightforward. I think anyone can reproduce what I have done easily using the description of the process used ( and probably faster as I still consider myself a Labview tyro )

 

Once I get back on schedule, i'll generate a data set and post the plot here.

 

-- Sam

 

 

Message 6 of 22
(13,072 Views)

@SamRogers wrote:

Ben,

...

Once I get back on schedule, i'll generate a data set and post the plot here.

 

-- Sam

 

 


Fine. That Kudoes is payment in advance for the image. Smiley Wink

 

Take care!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 22
(13,069 Views)

Ben, I generated a dummy data set with 4 dimensions of data. This data set is regular in X&Y, but normally my data would not in a regular pattern. That is why I usually use a scatter plot to show the results. For this, i generated a function, Z = X^2 - Y^3, over the range of -1 to 1 in X & Y. I then set my W value to the radial distance in the XY plane to create the 4d data set XYZW. The first plot shows the 3d plot of only XYZ. THe color map is automatically generated to map the Z axis. THe second plot shows the XYZW data with the color vector mapped to W. This was done using the procedure I outlined in the previous post. The 3rd plot shows the XY projection of the 4D data to show the radial mapping of the W data and associated colormap.

 

And thank you for the kudos.

 

-- Sam

 

Download All
Message 8 of 22
(13,022 Views)

Sam,

 

I found your solution to be fascinating,  Could you go into a little more detail in how you bined the data so you could colorize it?   I have a similar task and did a very dirty job of developing 5 bins and simply sorting my data into a set of 5 different XYZ plots.  I then ploted all 5 graphs on the same 3d scatter control. Each plot had its own color.

 

It seems you did something similar but on a much larger scale.  Can you post some code or would that violate a work agreement?  You already mentioned the data was proprietary.

 

 

0 Kudos
Message 9 of 22
(12,860 Views)

Gruntboy50,

 

I sounds like you did basically the same thing I did, just with fewer bins. I will upload a few snippets showing the binning / color table / graph assignments this evening ( I left laptop at home today ).

 

I think that if I were to attempt to do this again I would likely use matplotlib with a python script or even Octave to do the plotting as both of these packages allow for individual control of the scatter symbol color. ( Matlab could be used as well, but I don't have a license for that ). The downside would be that I likely would have to write data to disk and then read it back. And maintaining another piece of code unreleated to Labview. Another downside to 'outside' packages is that the users are used to Labview style interfaces. This would increase the number and frequency of 'teaching moments'.

 

-- Sam

Message 10 of 22
(12,835 Views)