LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Color Box problem in Waveform Graph

Solved!
Go to solution

     I'm not sure why creating Graphs (especially "nice" Graphs) can be so tricky in LabVIEW.  I've coded an algorithm for analyzing data from "learning experiments" where subjects are given a signal and must do a Task as quickly as possible.  If they get it right, it is a "Hit", if wrong, a "Miss".  They don't "know the rule" for associating the "signal" with the "Task", but are expected to learn it during the trial.

 

     The "easy part" was the hairy statistical algorithm.  The "hard" part was getting the plot exactly right.  I know part of the problem, but not all of the "solution".

EM Learning.png

Here is the Graph.  There are 5 plots -- three (Yellow, Red, and Green) are "Learning" plots, the probability that the Subject has "learned" the Task at that Trial, which shows that one can say with 95% probability (Yellow) that this occurs on Trial 27.  The last two plots are the "Hits" (Blue squares at the top of the Graph) and "Misses" (White "x" at the bottom).

 

The "Problem" is both Hits and Misses are supposed to be White (because I told them to be!).  Here's the Front Panel of the routine that "labels" the Graph:

Graph Labeller FP.png

You can see that the Front Panel shows two White color boxes.  Just to be sure, I added an Indicator (shown blank) that ends up with two White boxes when the code runs.

Graph Labeler.png

Here's the code.  The first For loop does the Lines (I use Delete from Array to get the three Line colors) and the second does the "Symbol" plots (5 is a square, 13 an "x").

 

think I know the problem, but I'm not sure how I caused it, nor quite how to "fix" it.  A Color Box is a 32-bit quantity which can be considered as 4 bytes -- the low three bytes correspond to Red, Green, and Blue, and the top byte has some function that's unclear.  It seems that Color Boxes can use those upper bytes, and if they do, they can influence the colors in some manner I don't understand.  Tried to find more on the Web, so far, not much success.

 

I haven't tried (because I hate to "Brute Force" a situation that I don't understand, rather than getting insight so I can actually use the unexpected "feature" in the future) "forcing" Color Box 4 (which seems to have the "Blue" attribute hidden there) to be a copy of Color Box 5 (which, surprise!, is White because that's the Color I chose, darn it).  Insights Appreciated!

 

Bob Schor 

 

0 Kudos
Message 1 of 10
(651 Views)

If you could attach your VI in version 2020, I can take a look tonight. Since you don't show the first invalid element, it is difficult to tell how big these arrays really are. For example, what's the size of the "outcome" array?

 

Why not AND (bitwise) the colors with x00FFFFFF to make sure there is nothing in the first byte?

0 Kudos
Message 2 of 10
(638 Views)

Hex code for white is 00FFFFFF.  Your "whites" are 01000009 which is the code for Highlight Text (which is usually white).

When bit 24 is 1 (01xxxxxx), the lower bits specify a system color.

paul_a_cardinale_0-1755466983780.png

 

Message 3 of 10
(617 Views)
Solution
Accepted by Bob_Schor

In particular, when picking your white with the color tool, stay away from the "system" area. 😄

 

altenbach_0-1755469286310.png

 

Message 4 of 10
(602 Views)
Solution
Accepted by Bob_Schor

Hi Bob,

 

I guess you know there are two color properties for plots!?

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 10
(583 Views)

Also, in second interior For Loop,  I think you want to index plot colors array explicitly rather than relying on auto indexing. The plot color index should equal the active plot, right?

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 6 of 10
(559 Views)

     Thanks to Altenbach, Paul, Gerd, and Doug for "filling in the lacunae in my LabVIEW Knowledge. Somehow I missed the discussion on System Colors. I just looked up "System Colors" in LabVIEW 2021's Help, where
a simple search didn't find it (it found "system testing", but if I scrolled up one, there was "system colors". There was not much information, and the link to "example at ni.com" didn't go anywhere.


I had "guessed" that the upper 8 bits of the 32-bit Color Box might be the culprit, but before flailing around not understanding the problem, I asked for help, and am grateful for your responses.

 

In answer to Doug's comment, I've previously plotted multiple lines on a Graph and have configured  the  individual Plot properties using Auto-indexing (and have checked by turning on Highlight Execution) that the numberings are as I'd expect. The "+1" between the two For Loops is the left loop runs 3 times (from 0 to 2), so the right loop needs to start one higher (at 3).

 

Now that I know about System Colors, I did a Web search which eventually took me to the LabVIEW  Wiki's  entry for Color, where System Colors are discussed.

 

Always good to Learn New Stuff about LabVIEW.

 

Bob Schor

0 Kudos
Message 7 of 10
(543 Views)

dsb@NI wrote:

Also, in second interior For Loop,  I think you want to index plot colors array explicitly rather than relying on auto indexing. The plot color index should equal the active plot, right?


My bad, I didn't notice that your code uses Delete From Array rather than Index Array in the first, inner For Loop. Please forgive my goof.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 8 of 10
(519 Views)

dsb@NI wrote:

dsb@NI wrote:

Also, in second interior For Loop,  I think you want to index plot colors array explicitly rather than relying on auto indexing. The plot color index should equal the active plot, right?


I didn't notice that your code uses Delete From Array rather than Index Array in the first, inner For Loop.


Instead of repeatedly deleting from an array in a shift register, the correct way would of course be to use "index array" in both loops, using the modified iteration terminal as index. (I assume the "color boxes" output subset is just for debugging.). I am also not sure why the outcome array is threaded across the first inner loop, but the compiler will take care of simplifying that).

0 Kudos
Message 9 of 10
(492 Views)

You're overthinking it a bit- Gerd's solution is right. You're setting the Plot Color to White. If you turn on the lines for those plots, you can see the plots are in fact white:

BertMcMahan_1-1755539298649.png

 

Add the property Plot.Fill/PtColor and wire it to the color box as well:

BertMcMahan_2-1755539344741.png

 

and now you have white boxes:

 

BertMcMahan_3-1755539358472.png

 

Edit: You may also have problems with system colors, but that's not why your points aren't white.

 

0 Kudos
Message 10 of 10
(476 Views)