[R] problem with xyplot

Deepayan Sarkar deepayan at stat.wisc.edu
Fri Nov 26 19:32:57 CET 2004


On Friday 26 November 2004 11:58, Carlisle Thacker wrote:
> Dear Rlisters,
>
> When trying to indicate which data belong to which of 7 groups, the
> following plot shows only 5 groups:
>
> ss <- trellis.par.get("superpose.symbol")
> ss$col <- c("red","blue","green","yellow","orange","magenta","cyan")
> ss$pch <- format(1:7)
> ss$cex <- 1.2
> ss <- trellis.par.get("background")

At which point, all the changes you made to 'superpose/symbol' are lost.

> ss$col <- "white"
> trellis.par.set("background",ss)
>
> xyplot(t~s,data=P0,
>   subset = p==1500 & whichLonP==2 & whichLatP==3 & t<6 &
> id>100000000, groups = id%/%1000)
> # don't see groups 6 and 7 ?????????????

xyplot(1:7 ~ 1:7, groups = 1:7)

works for me (produces 7 distinct colors). I don't see how we can 
diagnose your problem without a (preferably small) reproducible 
example.

> But groups can be put into separate panels:
>
> xyplot(t~s|factor(id%/%1000),data=P0,as.table=TRUE,
>   subset = p==1500 & whichLonP==2 & whichLatP==3 & t<6 &
> id>100000000)
>
> And using a smaller dataframe helps:
>
> temp <- P0[P0$p==1500 & whichLonP==2 & whichLatP==3 & P0$t<6,]
> xyplot(t~s,data=temp,
>   subset = id>100000000,
>   groups = id%/%1000)
> # get different labels but all groups
>
> Also, for other plots involving large dataframes, specifying groups
> made the plotting very slow.

Every level in groups causes a call to grid.points (within each panel), 
so a large number of levels in groups could well make things slow.

Deepayan




More information about the R-help mailing list