An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100102/a75f3b57/attachment.pl>
Boxplot- input the median point and the median value
4 messages · milton ruser, Jim Lemon, elaine kuo
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100102/0330e7f3/attachment.pl>
On 01/02/2010 12:53 PM, elaine kuo wrote:
Dear, I am a newbie to R. Now I am learning to draw boxplot using graphics(). I want to highlight the median position with a round point and the value left (or on the top of)to the point.
Hi Elaine, For your boxplot questions, I'll use the first example from the boxplot help page: boxplot(count ~ spray, data = InsectSprays, col = "lightgray",yaxt="n") axis(2,c(2,8,14,20),c(2,8,14,20)) For the "dotted to solid" question: boxplot_info<-boxplot(count ~ spray, data = InsectSprays,col = "lightgray") segments(rep(1:6,each=2),boxplot_info$stats[c(1,4),], rep(1:6,each=2),boxplot_info$stats[c(2,5),]) And finally, for the median value question: boxplot_info<-boxplot(count ~ spray, data = InsectSprays, col = "lightgray") points(1:6,boxplot_info$stats[3,]) text(1:6,boxplot_info$stats[3,]+1,boxplot_info$stats[3,]) A bit messy, but you get the idea. Jim
8 days later
Hello Jim, I tried your approach on box plot, and it is useful. Thanks. However, I wanna add the mean value right or left to the mean point. (as attached) Please kindly share if it is possible and thanks again. Elaine
On Sat, Jan 2, 2010 at 5:01 PM, Jim Lemon <jim at bitwrit.com.au> wrote:
On 01/02/2010 12:53 PM, elaine kuo wrote:
Dear, I am a newbie to R. Now I am learning to draw boxplot using graphics(). I want to highlight the median position with a round point and the value left (or on the top of)to the point.
Hi Elaine, For your boxplot questions, I'll use the first example from the boxplot help page: boxplot(count ~ spray, data = InsectSprays, col = "lightgray",yaxt="n") axis(2,c(2,8,14,20),c(2,8,14,20)) For the "dotted to solid" question: boxplot_info<-boxplot(count ~ spray, data = InsectSprays,col = "lightgray") segments(rep(1:6,each=2),boxplot_info$stats[c(1,4),], rep(1:6,each=2),boxplot_info$stats[c(2,5),]) And finally, for the median value question: boxplot_info<-boxplot(count ~ spray, data = InsectSprays, col = "lightgray") points(1:6,boxplot_info$stats[3,]) text(1:6,boxplot_info$stats[3,]+1,boxplot_info$stats[3,]) A bit messy, but you get the idea. Jim