Difference between whisker and adjacent value handlers in box plot?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have a doubt concerning boxplot handlers. If I want to extract some values from my boxplot I should write this code according to the documentation:
h = findobj(gcf, 'tag', 'Median'); median = cell2mat(get(h,'YData'));
h = findobj(gcf, 'tag', 'Upper Whisker'); up_whisker = cell2mat(get(h,'YData'));
h = findobj(gcf, 'tag', 'Upper Adjacent Value'); up_adj = cell2mat(get(h,'YData'));
h = findobj(gcf, 'tag', 'Lower Whisker'); low_whisker = cell2mat(get(h,'YData'));
h = findobj(gcf, 'tag', 'Lower Adjacent Value'); low_adj = cell2mat(get(h,'YData'));
It's not clear to me the difference here between adjacent values and whiskers.
In my case, I see that actually the adjacent values are the 2 extreme (min/max) whiskers of the boxplot, but there's a weird behaviour for the whiskers handlers (bug?): the "Lower Whisker" returns the same value as the "Lower Adjacent Value", while the "Upper Whisker" returns a value which corresponds to the upper 25% quantile.. I find it quite inconsistent. This doesn't make much sense to me, but I'm maybe missing something?
Thanks in advance,
Stefano
0 commentaires
Réponses (1)
Jeremy Kemmerer
le 29 Sep 2014
It sounds like you would like to access data values directly from a boxplot, such as the median and the ends of the whiskers, and are unclear how whiskers and adjacent values are different.
The boxplot object with the tag ‘ (Upper or Lower) Adjacent Value ’ corresponds to the horizontal line of the whisker and denotes the most extreme (largest or smallest, respectively) data point that is not an outlier in the plot. The ‘ (Upper or Lower) Whisker ’ tag is associated with the vertical line extending from the 1st or 3rd quartile of the box plot to the adjacent value line.
Because they are lines, the ‘Xdata’ and ‘Ydata’ properties of these objects are each a vector containing the positions of the endpoints of the lines. You can probably access the value you are interested in either way, although the adjacent value may be easiest. Also, you will not need to use the ‘ cell2mat ’ function to retrieve these values.
If, for example, you would like to access value at the bottom whisker ( lower extreme value ), you could do something like:
>>h=boxplot(…);
>>T = get(h(4),'YData');
>>lev = T(1);
Here I used ‘ h=boxplot(…) ’ to receive a vector of handles to the boxplot objects instead of using the ‘ findobj ’ command.
Please refer to the following documentation for more information about the boxplot command: http://www.mathworks.com/help/stats/boxplot.html
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!