LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

plot x-y with intensity

I am running LabVIEW 2009 and would like to plot an x-y graph where the plot changes color based on a third dimension. My thought is to use an intensity graph with zeros everywhere except along the 'line' I am trying to plot (these points would have the value specified by my third dimension). I am running into two problems with this:

 

1) Because my arrays are ~200,000 points long, I would have to create a 200000 x 200000 array to plot all my data, which causes memory errors. I am willing to decimate to get it down to a manageable amount of data, but any other suggestions would be welcomed.

 

2) Now that I have a reasonable amount of data, I am not sure how to get it so the array is zeros everywhere except along the line. Any suggestions as to how I can index the points along this plot?

 

Thanks in advance for your suggestions,

John

0 Kudos
Message 1 of 13
(4,720 Views)

Unless you allow scrolling or zooming, all you need is a 2D array of the size of the intensity graph indicator (one array element per pixel). Basically, you would map your data into it as a 2D histogram, for example. 

 

 

If you want to graph actual lines, have a look at this old example, maybe you can recycle some of the code. 😉

0 Kudos
Message 2 of 13
(4,719 Views)

Hi John,

 

Have you played around with the Property Nodes for the XY Graph?  There is a property called "plot color" that I think would be helpful.  To get this property node, right click the XY graph and choose Create>Property Node>Plot>Plot colors.  There is also a Plot Area, if that is what you are looking to change.

 

Cheers,

 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 3 of 13
(4,680 Views)

Thanks for your responses.

 

Altenbach, agreed this is what I was thinking, but I'm unsure how to map the data correctly and I wasn't sure what you meant by the histogram idea. There is also still the problem of my arrays being far too large.

 

Marti, this property node appears to let me change the whole plot color, but what I need is for each point on the plot to be a different color. Is there any way to do this within an xy graph?

 

John

0 Kudos
Message 4 of 13
(4,671 Views)

John,

 

As you recognized in your original post you do not want hundreds of thousands of points on your graphs.  For a line graph you only need one point per pixel of width.

 

Make the point you do not want visible have the value NaN (Not a Number).  Points with NaN values are invisible on plots.  Make as many plots as you want colors.  Fill them all with NaN initially.  Then replace the segments with the real data according to which color you want displayed for that value.

 

Lynn 

0 Kudos
Message 5 of 13
(4,667 Views)

Lynn,

 

A few questions about this: First of all I'm having trouble programmatically changing the color of any plot besides the first one (I would think this is just a mistake on my part, but I'm not sure). Also, my array of colors is 164,811 long, and the way I'm reading your post I would have to have a new plot for each color, which again seems like a waste. Any thoughts? Thanks.

 

John

0 Kudos
Message 6 of 13
(4,660 Views)

John Lipor wrote:

A few questions about this: First of all I'm having trouble programmatically changing the color of any plot besides the first one (I would think this is just a mistake on my part, but I'm not sure).


You need to iterate across the active plots, e.g. make a proerty node with two entries: "Actve plot" on top and the plot color property on the bottom.  Now place it in a for loop with [i] wired to the active plot and autoindex on an array of colors. Remeber, property nodes are executed top to bottom.

 

 

It will definitely be too involved with so many plots, so using an intensity graph would be the way to go.

 

Can you attach some data and your current code?

0 Kudos
Message 7 of 13
(4,655 Views)

John,

 

What I suggested requires a separate plot for each color.  It works well for someone who wants red, green, and yellow.  For your color array I would agree with altenbach that you need to use the intensity graph.

 

Lynn 

0 Kudos
Message 8 of 13
(4,642 Views)

Also, what you probably want is the line color to also interpolate between points. This is not possible with an xy graph. Only an intensity graph or picture indicator would allow that.

 

If you say that your array of colors is 164,811 long, does that mean you have 164,811 different colors? A color ramp of 256 colors is probably sufficient.

 

 

0 Kudos
Message 9 of 13
(4,632 Views)

The code is too big to attach, so you can find it at the link below. It's clearly not right but might give you a better idea of where I'm going. What I want is a plot of alpha vs wavelength with each point receiving its color from E"a. I'm decimating by 100 because that doesn't give me memory errors. Thanks.

 

John

 

mywebspace.wisc.edu/lipor/ni

0 Kudos
Message 10 of 13
(4,628 Views)