LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boxplot bug?

Solved!
Go to solution

Hi guys,

 

When I was looking for an example on how to plot a boxplot in LabVIEW I found these two examples:

 

https://forums.ni.com/t5/Example-Code/Creating-Boxplots-Using-LabVIEW/ta-p/3534434
https://forums.ni.com/t5/Example-Code/Boxplots-and-Stem-and-Leaf-Displays/ta-p/4100673


On first glance the example boxplot.vi in the library boxplot.llb seemed OK, but apparently there's something wrong with the upper whisker.
It extends all the way to around 120, but it should be 100 (this is the largest number in the population).
See the attached screenshot. The other elements (median, quartiles, lower whisker) are OK.
The other screenshot (from Gnumeric) shows the correct boxplot for the population: 18,27,34,52,54,59,61,68,78,82,85,87,91,93,100
You can also verify this online: http://www.alcula.com/calculators/statistics/box-plot/ or use a spreadsheet/statistical program like Excel, Gnumeric or SPSS.

Before I dive into the code, can anybody please verify this bug exists or am I doing something wrong? Thanks in advance.

 

Paul

Download All
0 Kudos
Message 1 of 7
(3,568 Views)

Don't look now, but it seems like your bottom whisker is wrong, too. Show us what you've done (your VI) and chances are good that someone can see where the problem occurs.

 

Cameron

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 7
(3,549 Views)

Hi Cameron,

 

Thanks for your reply. To answer your question: I haven't modified anything yet, this is the result you get when you run boxplot.vi from the library boxplot.llb which you can download from https://decibel.ni.com/content/docs/DOC-4929

 

Paul

0 Kudos
Message 3 of 7
(3,523 Views)

Hello Paul,

 

It seems like there are 2 (or even more) different boxplot.llb's downloadable from the web.

 

Are you using the one that was originally provided by this white paper: https://forums.ni.com/t5/Example-Code/Boxplots-and-Stem-and-Leaf-Displays/ta-p/4100673#toc2

Or are you using the modified version used/made by "Hillman":
https://forums.ni.com/t5/Example-Code/Creating-Boxplots-Using-LabVIEW/ta-p/3534434

 

I'm guessing the latter because you refer to that Community page, but on that Community page they refer back to the white paper

Please let me know, so that I'm sure which one you're talking about.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 7
(3,511 Views)

Hello Thierry,

 

I'm referring to the one modified by 'Hillman', however it doesn't matter which one you download: both the 'Hillman' version as the original version show the same behaviour.

The problem seems to be the 'compute whiskers.vi' library component. It's the same in both libraries.

 

Paul

 

0 Kudos
Message 5 of 7
(3,504 Views)
Solution
Accepted by topic author Perreijn

In the explanation of boxplots in the original whitepaper (which is the one Hillman uses, just putting bars at the end of the whiskers for clarity), there is the statement in the first paragraph under the first boxplot figure, "The whiskers are 1.5 times the inner quartile spread in length, which you measure from the median." Like you say, this is not how "normal" boxplots work (at least not in my experience). If you go into the subVIs, however, you could easily change your whiskers to give the max and min of your arrays as whisker ends, rather than the computed values from "Compute Whiskers.VI".

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 6 of 7
(3,491 Views)

Hi Cameron,

 

You're right, the boxplot isn't wrong, but using 1.5 IQ and 3 IQ for calculating the whiskers is not very common. The common way is using the min. and max. non-outlier data for calculating the whisker lengths. To be sure I asked a statistician and according to her both methods have their ad- and disadvantages.

For future reference and to help others, here's the alternative method of calculating and drawing the whiskers (compute boxplot data.vi):

alt_boxplot.png

 

Thank you for your help.

 

Paul

0 Kudos
Message 7 of 7
(3,478 Views)