[R] xyplot squeezed together

Sarah Goslee sarah.goslee at gmail.com
Sun Dec 4 15:36:45 CET 2011


You specified the aspect ratio, so your plots must have that ratio
of width to height.

It looks like you are trying to control layout by specifying aspect
ratio? That, as you've discovered, is an ineffective way to do it.

Instead, you should specify layout directly, using for your example
layout=c(3,1,1)
and deleting the aspect='xy' argument.

Rereading the help for xyplot()  more carefully would also be a good
idea.

Sarah

On Sun, Dec 4, 2011 at 6:49 AM, syrvn <mentor_ at gmx.net> wrote:
> Hi,
>
>
> I created the following example of a xyplot. The plot actually looks ok
> apart from that the
>
> x-axis is pretty squeezed/clinched. I tried aspect="fill" already but I want
> to have all 3 sub plots
>
> next to each other. I tried loads of different scaling varieties but with no
> significant result...
>
>
>
> library(lattice)
>
> N <- 6
>
> d <- data.frame(factor(rep(c("A1","A2","A3"),each=N),
> levels=c("A1","A2","A3")),
>
>                       factor(rep(c("B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9"),
> each=N/3),
>
>                                  levels=c("B1", "B2", "B3", "B4", "B5", "B6", "B7",
> "B8", "B9")),
>
>                                    rep(c(0,1), each=N/3/2))
>
> colnames(d) <- c("ID", "class", "group")
>
> value <- matrix(c(400,300, 320,380, 410,500, 800,670, 810,900, 560,750,
> 1100,1200, 1200,1300, 1300,1200))
>
> d <- cbind(d, value)
>
> xyplot(value ~ group | ID, d, groups = class, type = c("g", "b"),
>
>          auto.key = list(lines = TRUE, columns = 3), xlab = "blocked=0,
> released=1",
>
>          ylab = "value", aspect = 'xy', scales=list(x=list(at=-1:2,
> labels=c("",0,1,""))))
>
>
>
> Anyone any ideas how to enlarge the x-axis?
>
> Cheers
>
>


-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list