LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D colormap plot

Solved!
Go to solution

Hello, guys

 

Now I have X and Y coordinates and each coordinate position has a corresponding value Z, now I want to make Z as the color to plot on X and Y graph, how can I do that? I searched the contour line plot example, but it seems that VI, Z is calculated by X and Y which is different from my situation. 

 

Thanks

0 Kudos
Message 1 of 15
(4,856 Views)

Hi Zyb,

 

You can use an intensity graph to plot your data. All you need is the 2D array of Z-values, then modify the graph properties to get the x- and y-axis values correct.

0 Kudos
Message 2 of 15
(4,846 Views)

Hello, 

 

I see what you mean, but in my application, it seems not that convenient to do so. Can we do like make x,y,z written to a function the same time, and then plot it? 

0 Kudos
Message 3 of 15
(4,833 Views)

Can you post a VI that includes your data? To make sure the data is stored, create an indicator for the array, run the VI, then change the indicator to a constant.

 

LV 2016 or lower please.

0 Kudos
Message 4 of 15
(4,822 Views)

My VI is like I use the step motor to scan the XY domain and measure the magnetic field. I use 'S shape' to scan it, like (-2,0);(-1,0);(0,0);(1,0);(2,0);(2;1);(1,1);(0,1);(-1,1);(-2,1); the step motor position X and Y and magnetic field measurement value Z are read each cycle. So I want is one measurement value corresponding to one group (x,y) and colormap it. 

0 Kudos
Message 5 of 15
(4,820 Views)

Yes.  Initialize an array with the dimensions you need and some default value (0, 1, NaN?).  Then as you acquire data just replace the data at the proper coordinates using "Replace Array Subset".

 

You can make the initial array bigger than needed and just trim using Array Subset at the end too, if your X,Y coordinates aren't equal.  Simple example..

 

xyz_heat_map.png

 

 

 

0 Kudos
Message 6 of 15
(4,818 Views)

Hello, 

Thanks for the reply. 

In my application, I need to show the actual x and y position, and my step size can be controlled. Can we make the x axis and y axis show actual position automatically? . 

0 Kudos
Message 7 of 15
(4,804 Views)

Yes, in fact I hinted at how to do it above. Modify the graph properties either by hand or with a property node.

snippet.png

Message 8 of 15
(4,800 Views)

Hello, 

 

Thanks for your reply. The property node does the job. And I find that the input for the inner loop is the random number, it updates every inner loop cycle so your method can do it. But for my application, the input is the value read from a while loop for each cycle. So how can we achieve the instant read value of while loop being the input of for loop for each cycle simultaneously without data loss? 

0 Kudos
Message 9 of 15
(4,774 Views)

I'm sorry you lost me with your question. Why don't you post your code along with a picture of what you hope to see (using MS paint or powerpoint is fine 🙂

0 Kudos
Message 10 of 15
(4,771 Views)