LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Contour Plot in Labview 7.1

Hi,
 
I have x,y,z data that I want to plot as a contour plot.  We take measurements of a sector of an annulus, this for example could cover 10degrees.  Tests can have a different amount of circumferential traverses and radial points (radial points for a given test would be constant) i.e. 41 circumferential by 21radial or 21x21.  The x/y data is in polar coordinates but i can turn that into rectangular for the purpose of the graph.  I have been looking at examples and playing around but find the problem is that the x and y do not form a structured grid in the rectangular sense.  I cannot even work out how to plot just the z values for a specific and point independent x and y value (i.e. no contouring).
 
Does anyone know how to do the contour plot OR just plot a x,y,z plot where the z matrix indices do not match the x / y values? I found an example that offsets and scales the x and y axis but that is not suitable i don't think. 
 
Surely you can just feed in x y and z arrays and plot them?!
 
Many Thanks
 
Chris
0 Kudos
Message 1 of 15
(8,091 Views)
Hiya Chris, apologies for the rather rushed response, but a VI speaks a thousand words!!
Have you seen the attached 3D graph example before? if not, it may be very useful.
Best wishes,
Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
0 Kudos
Message 2 of 15
(8,068 Views)

Hi,

Thanks for that...

I have everything working as I want it to but tried to implement a colour map for the 3D graph (I can't believe one isn't a standard option?!) using an intensity graph - infact the code came from another thread on here.

The problem is I cannot work out why some of the intensity plot shows as yellow instead of red, this breaks the colour map (yellow bit at the top).  Does anyone know how to make the colour map work correctly - I've set the contours on the 3D graph to go from blue to red not black to white but looking through the code I can't see why this would break it.

Many Thanks

Chris

0 Kudos
Message 3 of 15
(8,052 Views)

Hello Chris,

Once again, I am going to let the .vi do the talking Robot wink Attached is a very simple method of defining the colour table of an intensity graph, using an array of clusters. The block diagram is incredibly simply, and doesn’t really require further documentation or explanation. At the moment, i am stumped as to why using the colours from the 3D plot is creating an erronious colour map for the intensity chart.

The attached vi is a simplistic example, but it may inspire you to a solution.

Best wishes,

 

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
0 Kudos
Message 4 of 15
(8,031 Views)
Thanks for that! I wish I'd found that before...
 
I think it is working correctly now however I want to get better precision on the colourmapvalues conversion from variant to data.  At the moment I am getting 0 decimal points which means for a low data range the values appear as 0,0,0,0,0,0,0 etc.  Can I wire a different 'type' into the variant to data vi to get better precision (2dp) - I've tried a few things but can't get it to work.
 
Many thanks!
 
 
Also, is there a wau of saving the 3d graph and colourmap from the intensity chart as one jpeg image? 🙂
0 Kudos
Message 5 of 15
(8,018 Views)

Hi Chris

Have you tried changing the representation of the 'type' input to the 'variant to data' function to double precision? You can just right click on the array constant that you already have and change the representation there.

With regards to saving two plots as a single jpeg, I have not yet been able to find a method of doing this. Do you need to do it programmatically? One option you could have is to save the front panel as jpeg. Would this be suitable?

Regards

Beejal S
NI UK & Ireland
0 Kudos
Message 6 of 15
(7,998 Views)

Hi Bejal,

A couple of quick notes (no time to read whole thread).

LV and CW colors are different one is RGB and the other is BGR.

Do an "invoke node" get image to get the image in the ActiveX container (hint: create invoke node from FP)

See here for Boltzmans find about 3d images.

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 15
(7,993 Views)

Hi,

Yes i had been trying that but it didn't make any difference - however i took an array constant from another vi and it worked fine (for some reason it just didn't seem to change the precision even when i changed the original array constant to double precision).

If that is the only way to do it then I can make it a possibility, I'll enlarge the plot etc to fill most of the front panel and then the user can just crop the output image.  However what resolution file will that output - i would really like it as high as possible?

Thanks

Chris 

0 Kudos
Message 8 of 15
(7,992 Views)

Hi Chris

You can use the 'get panel image' invoke node to get the image data of the VI. This invoke node will need to be associated with the VI itself rather than a individual control. There is a parameter on this invoke node which allows you to select just the visible area on the front panel. You can set the 'visible area only' parameter to true (it is true by default). Then if you make sure that the size of the front panel is such that only the 3D graph control and the intensity graph are visible.

Once you have the image data from this invoke node you can use the 'Write jpeg file.vi' to create the jpeg image. I am not sure if the resolution will be appropriate but it might be worth you trying it out to see.

I have attached an image below showing the implementation of this.

Let me know how you get on

Regards

Beejal S
NI UK & Ireland
0 Kudos
Message 9 of 15
(7,961 Views)

Hi,

Thanks for the information.  I got the front panel image but the quality isn't great - am I right in thinking it is only captured at 96dpi?

Am i able to save the cwgraph plot directly at a higher resolution (i read somewhere you can specify it?) and then also save the colourmap as another image (again I found an example of saving partiular objects however that looked quite involved).  I could then open the two images and crop and position them to form the plot with colourmap by its side.

Could you detail how you save just the cwgraph image - i can't find the controlimage property?!

Also do you know how I can make the x and y axis dependent - i.e. so they have the same scale so that my image is sized correclty?

I'm using the colourmap from the intensity graph by sending an array of 6 colours with 6 values but this means there are only 6 range markers - is there a way of setting the increments of the range shown to fill in the gaps or do I have to feed in 12 colours and 12 values (i don't want to have to do that!)

Sorry for all the questions....:)

Cheers

Chris

 

0 Kudos
Message 10 of 15
(7,955 Views)