[R] A problem of splitting the right screen in 3 or more independent vertical boxes:

David Winsemius dwinsemius at comcast.net
Sat May 4 01:07:28 CEST 2013


On May 3, 2013, at 3:21 PM, Sarah Goslee wrote:

> Hi Aldi,
> 
> You might want
> ?layout
> instead.
> 

Indeed. In particular a matrix argument might be:

matrix(c(1,2,3, 4,4,4)


> Sarah
> 
> On Fri, May 3, 2013 at 5:54 PM, Aldi Kraja <aldi at wustl.edu> wrote:
>> Hmm,
>> I had a typo paste by mistake in my x vector
>> It has to be:
>> 
>> x<-rnorm(1000,mean=0,sd=1)
>> wheat1<-rnorm(100,mean=0,sd=1)
>> wheat2<-rnorm(150,mean=0,sd=2)
>> tomatos3<-rnorm(200,mean=0,sd=3)
>> tomatos4<-rnorm(250,mean=0,sd=4)
>> cucumbers5<-rnorm(300,mean=0,sd=5)
>> cucumbers6<-rnorm(400,mean=0,sd=6)
>> par(mfrow=c(1,2))
>> 
>> hist(x, main="Left screen OK")
>> 
>> boxplot(wheat1,wheat2,tomatos3,tomatos4,cucumbers5,cucumbers6)

I think you will need a separate call to boxplot for each grouping. The `boxplot` function will nto be able to access the device specifications.


-- 
David.


>> title ("Right screen: boxplot with plants")
>> 
>> Thanks,
>> 
>> Aldi
>> 
>> On 5/3/2013 4:46 PM, Aldi Kraja wrote:
>>> 
>>> Hi,
>>> Based on par function, I can split the screen into  two parts left and
>>> right.
>>> I wish x occupies the half left screen, and all plants occupy half right
>>> screen, which happens right now.
>>> 
>>> But I wish the right screen, to be split in 3 or more vertical parts where
>>> each pair of the same type of plant, are together in its own block of
>>> boxplot, because each plant has its own unit of measure.
>>> Let's say wheat is measured in ton, tomato in pound and cucumbers as
>>> counts. :-)
>>> 
>>> x<-rnorm(1000,mean=0,sd=1,main="Right screen")
>>> 
>>> wheat1<-rnorm(100,mean=0,sd=1)
>>> wheat2<-rnorm(150,mean=0,sd=2)
>>> tomatos3<-rnorm(200,mean=0,sd=3)
>>> tomatos4<-rnorm(250,mean=0,sd=4)
>>> cucumbers5<-rnorm(300,mean=0,sd=5)
>>> cucumbers6<-rnorm(400,mean=0,sd=6)
>>> par(mfrow=c(1,2))
>>> 
>>> hist(x, main="Left screen OK")
>>> 
>>> boxplot(wheat1,wheat2,tomatos3,tomatos4,cucumbers5,cucumbers6)
>>> title ("Right screen: boxplot with plants")
>>> 
>>> Thank you in advance for any suggestions,
>>> 
>>> Aldi
>>> 
> 
> 


David Winsemius
Alameda, CA, USA



More information about the R-help mailing list