Re: [R] How to generate a figure using par( ) with some densityplot( )'s

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Tue 27 Jun 2006 - 03:41:21 EST

Deepayan Sarkar wrote:

> On 6/26/06, Sundar Dorai-Raj <sundar.dorai-raj@pdf.com> wrote:
> 

>>
>>
>> Amir Safari wrote:
>> >
>> > Hi Dear R users,
>> > For a pair plotting, usaully we use par( ) function. Apparently it
>> does not work anywhere. I want to have 3 plots in a single figure,
>> like this:
>> > par(mfrow=c(3,1))
>> > densityplot( a)
>> > densityplot(b)
>> > densityplot(c)
>> > But it does not work. How is it possible to have such a figure
>> with densityplot( ) in a single figure?
>> > So many thanks for any help.
>> > Amir Safari
>> >
>> >
>> >
>>
>> Assuming you are talking about densityplot in lattice, then you are
>> missing the point of lattice. You should try:
>>
>> library(lattice)
>> set.seed(1)
>> a <- rnorm(100)
>> b <- rnorm(50)
>> c <- rnorm(75)
>> densityplot(~a + b + c, outer = TRUE, layout = c(3, 1))
> 
> 
> This only works if a, b and c are of the same length. The following
> should work though:
> 
> densityplot(~data | which,
>            data = make.groups(a, b, c))
> 
> -Deepayan
> 

Hi, Deepayan,

My mistake. This is clear in ?densityplot. However, there is no warning if the condition is not met and, apparently, recycling rules are applied.

Thanks,

--sundar



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 27 03:45:12 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 27 Jun 2006 - 06:12:50 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.