[R] How to create interrupted boxplot

David Winsemius dwinsemius at comcast.net
Mon Mar 12 19:07:43 CET 2012


On Mar 12, 2012, at 1:19 PM, jianghong deng wrote:

> Hello,
>
> I have created two boxplots with following R code. There is one  
> outlier in
> B group.
> The outlier is 33. But the all other data are between 0 to 4.
>
> How can I skip y-axis around 5 to 25, and expand 0-4 for this case.  
> Also I
> want keep the outlier in my boxplot.
> I want my boxplot look like the second one, keep the outlier, and  
> make an
> interrupt of y-axis from 5 to 25.

Have you looked at the interrupted axis functions, axis.break,   
gap.plot and .... wait for it ... gap.boxplot, in package plotrix?

>
> Thanks,
> Jianghong
>
>
> Example = c( 0.00,0.33,0.75,3.00,2.50,0.50,2.00,33.00)
> Grp_Example =c("A","A","A","B","B","B","B","B")
>
> Example_Data= cbind(Example,Grp_Example)
> attach(Example_Data)
>
>
> boxplot(Example ~ Grp_Example,main=paste("Boxplot of Example"),
> pars = list(boxwex = 0.25, staplewex = 0.25, outwex = 0.25))
>
> boxplot(Example ~ Grp_Example,main=paste("Boxplot of  
> Example"),ylim=c(0,4),
> pars = list(boxwex = 0.25, staplewex = 0.25, outwex = 0.25))
>
> 	[[alternative HTML version deleted]]

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list