Brownian thought space

Cognitive science, mostly, but more a sometimes structured random walk about things.

My Photo
Location: Rochester, United States

Chronically curious モ..

Wednesday, October 06, 2010

Matlab boxplot notch "error" resolved

Use Matlab? Try this:
>> load carsmall
>> boxplot(MPG,Origin,'notch','on')
See something weird? Something that looks like this image with the boxes folded over? It's been driving me crazy for a while; I thought I'd broken Matlab somehow; till I discovered this little documentation. Essentially, before R2008b, the notches were truncated to the edges of the box. Since that's wrong, in the sense that the notches (robust estimates of the median) could extend beyond the box edges, Matlabbers fixed this, so now the notches go to wherever they please; but sometimes it makes the figures look weird.
From the Mathworks website:
  • For small groups, the 'notch' parameter sometimes produces notches that extend outside of the box. In previous releases, the notch was truncated to the extent of the box, which could produce a misleading display. A new value of 'markers' for this parameter avoids the display issue.

As a consequence, the anova1 function, which displays notched box plots for grouped data, may show notches that extend outside the boxes.

For comparison, the second figure is how boxplot used to work.


Anonymous Anonymous said...

hi, the link to "little documentation' is dead. Do you have another one?

October 30, 2013 11:30 AM  
Blogger mohinish said...

Oops! It's

October 30, 2013 1:35 PM  
Anonymous Anonymous said...

Thanks a lot,
Still, have you found an official documentation about that bug or is that just a guess of yours?
I have investigated, but could not find anything.
I was suspecting a bug as well, but would rather have something official.
Is there a function to modify, a-posteriori, the plot displayed by anova1, something like setting 'notch' to 'off' in the plot that appears?

October 30, 2013 4:39 PM  
Blogger Karthika Shree said...

Usually I do not read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Great work admin.Keep update more blog.
Matlab Training in Chennai

June 13, 2017 12:42 PM  

Post a Comment

Links to this post:

Create a Link

<< Home