08-03-2025 04:53 AM
I want to plot a scatter graph in LabVIEW where the color of the points reflects the local data density; for example, regions with more overlapping points appear brighter (like a heatmap), and sparse regions appear darker.
How can I achieve this in LabVIEW?
Is there a way to color points based on density or overlay an XY scatter plot on top of a density plot (Intensity Graph)?
08-03-2025 06:21 AM
Calculate a picture and display it using picture control.
Alternatively use .net control with some opengl.
08-03-2025 08:05 AM
This sounds like the Intensity Chart and Intensity Graph, which you can find on the Front Panel "Graph" Palette. I've never used these, so won't offer any advice other than to check out the Examples that ship with LabVIEW.
Bob Schor
08-03-2025 08:50 AM
@sonisatyam wrote:
Is there a way to color points based on density or overlay an XY scatter plot on top of a density plot (Intensity Graph)?
So you already have an intensity graph that contains your data as a 2D array (x(i), y(j), z=count quantized to the grid defined by x0,dx and y0,dy, etc.). If your data is scattered (i.e. many point of the intensity graph have missing values, you could probably convolute it with a 2D Gaussian for example to get a smooth heat map.
I don't understand what you want to "overlay". Can you show an example picture (e.g. from a different program) of what you are trying to achieve?
Can you attach some typical data?
08-03-2025 02:02 PM
This is the type of plot I want on my front panel as a scatter plot
08-03-2025 02:24 PM
Just create a 2D array of sufficient resolution and map you data into it, the display in an intensity graph.
Create a suitable color ramp for the z axis.
Is the colored island some surface fit to a model?
Again, can you attach some typical data and also maybe show a picture that has a bit more resolution and also tell us what the color code means?
08-03-2025 03:04 PM
I don't have any data yet, above screenshot was from a research paper describing the prototype I'm building. It shows a pulse signal, where each peak corresponds to a passing droplet. I need to plot peak amplitude versus peak width, and the plot should highlight areas of data point accumulation by increasing their brightness or color. This visualization will help in setting threshold values using cursors.
(Instead of plotting each point as a simple marker, my interface brightens the color or increases the intensity where many points accumulate.)
08-03-2025 04:02 PM
Here's a simple example how you can basically a 2D historgram (normalized count vs. x&y)
(In this case we simulate Box-Muller pairs quantized to the 2D array grid..
08-05-2025 02:43 AM
Just for fun. The same image, but after 500M iterations (about 0.119 ms per iteration, i.e. it took 16 hours and 28 minutes):
08-05-2025 03:17 AM
@D_mitriy ha scritto:
Just for fun. The same image, but after 500M iterations (about 0.119 ms per iteration, i.e. it took 16 hours and 28 minutes):
It took that long because you probably redrew the graph every iteration. If you move it outside the loop it takes me about 40 seconds to do 500M iterations: