[R] how to control lattice plot parameters

2009-04-15 Thread Paulo E. Cardoso
I'm not being able to control all parameters of a xyplot.

dataset example:
> tabp[1:10,]
   time  n X id   name
1 1 95  0.00  1 Coral reef
2 1 93  0.00  2 Coral reef
3 1 92  0.00  3 Coral reef
4 1 90  0.00  4 Coral reef
5 1 87  8.994321  5 Coral reef
6 1 86 12.580143  6 Coral reef
7 1 84 17.004030  7 Coral reef
8 1 83 18.469500  8 Coral reef
9 1 82 37.919033  9 Coral reef
101 81 39.059352 10 Coral reef
...

plot code:
xyplot(
  X~n,groups=name,data=tabp[tabp$time %in% c(1,4,8),],  
  ylab="% of target",
  xlab="PU selection Frequency",  
  lty=c(1,3,5), #! not responding
  xlim=c(-10,110),
  scales=list(cex=0.7,at=seq(0,360,by=20),labels=seq(0,360,by=20)), #!
not responding   
  panel=function(x,y,groups,subscripts)
  {
panel.xyplot(x,y,
subscripts=subscripts,
groups=groups,
type="l")
panel.abline(h=30,lty=2,col="grey50")
  },
  key=list(
space="top",
columns=1,  
text=list(levels(tabp$name)[c(2,5,11)]),
lines=list(col=c("grey","blue","green"))
)
  )

A few controls are not responding and I don't know how to:
1) control cex for xlab and ylab
2) control position of legend
3) control lty for each group level
4) control plot groups colors
5) match legend colors with graph colors
Any help will be very appreciated.


Paulo E. Cardoso

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to control lattice plot parameters

2009-04-18 Thread Sunil Suchindran
We can see the plotting options using trellis.par.get(). For example, one
listed parameter is $superpose.line for which we can set col, lty, and lwd.
Load the mlmRev package to obtain the Gcsemv data (used in Lattice book).
One way to set the parameters is

data(Gcsemv, package = "mlmRev")

my.fonts  <- list(font = 2,cex = 2)

my.theme <- list(
superpose.symbol = list(col=c(1,3)),
superpose.line=list(col=c(1,3),lwd=c(1,2)),
par.xlab.text = my.fonts,
par.ylab.text = my.fonts
)

xyplot(written ~ course , data = Gcsemv, groups = gender, type = c("p","r"),

   par.settings = my.theme,
   auto.key = list(lines = TRUE, points = FALSE))
On Wed, Apr 15, 2009 at 5:40 AM, Paulo E. Cardoso wrote:

> I'm not being able to control all parameters of a xyplot.
>
> dataset example:
> > tabp[1:10,]
>   time  n X id   name
> 1 1 95  0.00  1 Coral reef
> 2 1 93  0.00  2 Coral reef
> 3 1 92  0.00  3 Coral reef
> 4 1 90  0.00  4 Coral reef
> 5 1 87  8.994321  5 Coral reef
> 6 1 86 12.580143  6 Coral reef
> 7 1 84 17.004030  7 Coral reef
> 8 1 83 18.469500  8 Coral reef
> 9 1 82 37.919033  9 Coral reef
> 101 81 39.059352 10 Coral reef
> ...
>
> plot code:
> xyplot(
>  X~n,groups=name,data=tabp[tabp$time %in% c(1,4,8),],
>  ylab="% of target",
>  xlab="PU selection Frequency",
>  lty=c(1,3,5), #! not responding
>  xlim=c(-10,110),
>  scales=list(cex=0.7,at=seq(0,360,by=20),labels=seq(0,360,by=20)), #!
> not responding
>  panel=function(x,y,groups,subscripts)
>  {
>panel.xyplot(x,y,
>subscripts=subscripts,
>groups=groups,
>type="l")
>panel.abline(h=30,lty=2,col="grey50")
>  },
>  key=list(
>space="top",
>columns=1,
>text=list(levels(tabp$name)[c(2,5,11)]),
>lines=list(col=c("grey","blue","green"))
>)
>  )
>
> A few controls are not responding and I don't know how to:
> 1) control cex for xlab and ylab
> 2) control position of legend
> 3) control lty for each group level
> 4) control plot groups colors
> 5) match legend colors with graph colors
> Any help will be very appreciated.
>
> 
> Paulo E. Cardoso
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.