From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a 3D plot of stacked 2D plots

Hello,

 

For my research I am used to read experimental files, which are basically .lvm files with five columns. I use labview to trace 2D plots of column 2 (signal) vs column 1 (frequency), which is very simple.

During an experiment I save a file after each seconds, so after an experiment I have several hundred files (let's say, n files). Because the frequency span doesn't change during the experiment, the column 1 (frequency) is always the same for all files. The only changes are the title of the file (which is the time), and the other columns including column 1.

 

I know how to trace column 2 vs column 1 of file 0 to n on the same 2D plot, but I don't know how to distribute the 2D plots on a third axis to make a 3D plot.

 

In summary, I need to stack column 2 vs column 1 2D-plots to create a 3D plot like this : Where X would be the frequency (column 1), Z the signal (column 2), and Y the time (title of the file).

 

Can someone give me an example of this kind of 3D plots ?

 

Thank you very much

 

0 Kudos
Message 1 of 12
(4,359 Views)

Open up the Help menu then Find Examples.

 

Search for 3D.  You'll find dozens of examples.  The one called 3D Ribbon Graph.vi looks particularly relevant.

0 Kudos
Message 2 of 12
(4,347 Views)

Hello,

 

Thank you for your answer, 3D ribbon is definitely what I needed. Yet, I have a problem when I try to use it.

It seems that I don't understand what to put in the different vector/matrix input of the 3D ribbon because I have :

 

The column 2 of the file on the Z axis, which can be OK.

Y axis is not the frequency (column 1) but the number of the frequency (there are 5001 frequencies on a file).

I don't know where to place the time on the 3D ribbon.

 

If possible, what I wanted was a 3D graph where the variables are Column 1 (which are frequencies), Column 2 (which are dB), and the time. Preferably the color of the ribbon would be related to the dB value but it's very optional, if the color is related to the time it can be OK too. 

 

I join the .VI I made and a .7z with example files, if someone can correct me it would be great.

 

I am sorry if I'm asking a stupid question, but I am very uncomfortable with everything related to data processing/programing. 😕

 

Thank you!

Download All
0 Kudos
Message 3 of 12
(4,294 Views)

It's better if you attach .zip files.  Not everyone has the program installed to be able to open .7z files.

 

What if you transpose the 2-D array?  So that X becomes Y and Y becomes X.  You would probably need to fix some other properties on the graph such as changing the names so they aren't "X-axis" and "Y-axis".  I don't know if there are properties that swap which side of the graph that the vertical grid planes show up on.

0 Kudos
Message 4 of 12
(4,283 Views)

Yes sorry, here I join the .zip file.

With your message I realized that the 1D arrays in the loop were converted in 2D arrays after the loop, because it makes an "indexation". I deleted the indexation for the Column 1 (frequency) that I inject in the Y vector, but I need to keep the indexation for the column 2 that I inject in the Z matrix, because the Ribbon Plot Helper is asking for a matrix. But the matrix, if I understand it right, is composed of the Column 2 values, and their indexation so I think I'm doing it wrong.

And when I try to put the time in the X vector, it doesn't appear on the 3D plot.

 

I join the new .VI in my post.

 

Thank you!

Download All
0 Kudos
Message 5 of 12
(4,274 Views)

Isn't this what you want?

 

I don't know what you mean by "indexation" and different columns, because I don't know how your measurements files are laid out.

 

But it looks like you have an X array of times.  A Y array of frequencies, and a Z matrix of "values" at each time and frequency.

 

0 Kudos
Message 6 of 12
(4,262 Views)

Yes this is exactly what I need !! 

As for the indexation, I talk about the fact that in the loop my variables are 1D arrays and after the loop they are 2D arrays. And when I right click on the square in the loop which makes the link between the wire in and after the loop, it speaks of an "indexation" that I can disable. 

(sorry if I am not clear, my labview is in french) 

0 Kudos
Message 7 of 12
(4,253 Views)

The only thing I did with that VI was right click on the graph and go to 3-D graph properties.  Went to axis and adjusted the names and settings for each axis.

 

Okay, when you talked about "indexation", the terminology that is used in English is "auto-index" or "auto-indexed tunnels".

0 Kudos
Message 8 of 12
(4,248 Views)

The only thing I don't understand is why a matrix is needed for the Z-axis, since it's only one variable, not a combination of two variables. X and Z axis for example are just vectors... 😞

 

Anyway the VI works and it will be helpful. Thank you very much for your help, the reactivity of NI community is appreciated.

0 Kudos
Message 9 of 12
(4,243 Views)

You have an X vector.  A 1-D array of X values.  You have a Y vector, a 1-D array of Y values.  The Z is a matrix because it is the value at the intersection of every X value and Y value.  So it is X size times Y size number of data points.

0 Kudos
Message 10 of 12
(4,240 Views)