LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

gray scale color bar not scaling evenly

Solved!
Go to solution

I have a 2d array of integers that I want to plot as a graph that is scaled from black (smallest value) to white (greatest value). I thought this would be simple, but I cannot get LabVIEW to scale the color bar evenly.  It's mostly white with a slight fade to black.  How does one do this?  The 50% value should be "middle" gray. In the example below, this would be ~32, but 32 is all white.  I've been tinkering with the color bar properties with no luck.

 

Jim12345678_0-1747235428767.png

 

0 Kudos
Message 1 of 10
(861 Views)

Each marker has a color (right-click). It seems you made most of them white. You can set the color ramp using a property node. (An array of clusters, each element is [marker value, color]) What is the range of values?

 

Is the Z axis set to autoscale? If you don't really need the z markers, you can delete all except the edge markers and you'll get a smooth ramp.

 

(Once you attach your VI (do "save for previous", 2020 or below) I can fix it for you in a few seconds.)

0 Kudos
Message 2 of 10
(848 Views)

I've attached an explicit if not efficient VI that creates an array of markers that generates a grey scale.  Take the marker array output from the VI and assign it to the z marker property node of the graph.

 

Jim12345678_0-1747332206031.png

 

0 Kudos
Message 3 of 10
(777 Views)

@Jim12345678 wrote:

I've attached an explicit if not efficient VI that creates an array of markers that generates a grey scale.  Take the marker array output from the VI and assign it to the z marker property node of the graph.


 

As improbably as it might appear to you, it can be done using a flat diagram without any stacked sequences, and hordes (hordes!!!!) of local variables! Should fit on half a postcard!

0 Kudos
Message 4 of 10
(748 Views)

All you need to do is set the colortable with a linear gray ramp. (Or any other color table you like!)

 

altenbach_0-1747417648881.png

 

0 Kudos
Message 5 of 10
(736 Views)
Solution
Accepted by Jim12345678

... and if you prefer to set the maker Z values property, here's arguably simpler code than posted earlier.

 

Note that the multiplication is set to output U8 in the output configuration, else an toU8 would be required

 

(It also works correctly. The code posted by Jim does not set the last marker among many other issues and flaws)

 

altenbach_0-1747418905161.png

 

0 Kudos
Message 6 of 10
(719 Views)

@altenbach wrote:

All you need to do is set the colortable with a linear gray ramp. (Or any other color table you like!)

 

altenbach_0-1747417648881.png

 


You can reduce that international sized stamp to a domestic sized stamp. Do more with less as someone once said. 🙂

mcduff_0-1747423908123.png

 

0 Kudos
Message 7 of 10
(712 Views)

Yes, I learned that a while ago, but now the code has measles. 😄

Message 8 of 10
(707 Views)

The accept as solution button isn't showing up, but this is a solution.

0 Kudos
Message 9 of 10
(648 Views)

Now it is showing up......

0 Kudos
Message 10 of 10
(647 Views)