[R] beanplot

Jim Lemon jim at bitwrit.com.au
Sun Feb 6 00:50:04 CET 2011


On 02/06/2011 09:12 AM, Paul Ossenbruggen wrote:
> Hello,
>
> 	sample1, sample2 and sample3 are vectors of numbers.
> 	The boxplot works properly but beanplot gives the following error for following run:
>
>>   boxplot(sample1, sample2, sample3, ylim = ylim, main = "boxplot", names = 1:3)
>>   beanplot(sample1, sample2, sample3, ylim = ylim, main = "beanplot", col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", names=c("A","B","C"))
>
> log="y" selected
> Warning message:
> In plot.window(xlim = c(0.5, 3.5), ylim = c(0, 100), log = "y") :
>    nonfinite axis limits [GScale(-inf,2,2, .); log=1]
>
> 	I cannot duplicate the error and warning with the following set of commands:
>
>>   par(mfrow = c(1, 2), mai = c(0.5, 0.5, 0.5, 0.1))
>>   mu<- 2
>>   si<- 0.6
>>   c<- 500
>>   mu1 = 60
>>   bimodal1<- c(rnorm(100, 60, 10), rnorm(900, 30, 10))
>>   bimodal2<-c(rnorm(999, 60, 10), rnorm(1, 30, 10))
>>   bimodal3<-c(rnorm(500, 60, 10), rnorm(500, 30, 10))
>>   ylim<- c(0, 100)
>>   boxplot(bimodal1, bimodal2, bimodal3, ylim = ylim, main = "boxplot", names = 1:3)
>>   beanplot(bimodal1, bimodal2, bimodal3, ylim = ylim, main = "beanplot", col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", names=c("A","B","C"))
>
> Here, bimodal1, bimodal2 and bimodal3 are vectors with numbers with the same range of values as above for sample1,sample2 and sample3.
>
> 	Please let me know how to fix the error.
>
Hi Paul,
Looks like you have a zero value in one of your "sample" vectors and not 
in your "bimodal" vectors.

Jim



More information about the R-help mailing list