[R] Setting the colors of lines in a trellis plot...

From: Jamieson Cobleigh <cobleigh_at_gmail.com>
Date: Tue 11 Jul 2006 - 03:16:44 EST

With some help from those with expertise on this list, I managed to produce a plot using trellis that looked like I wanted it to look. Now, I need to take the same plot and make the lines on it color, but I want to specify the color for the lines myself.

I've managed to make the key use the colors I want. I've managed to make the symbols of the actual plot use the colors I want. But I have been unable to find the correct incantation to make the lines of the actual plot use the colors I want. Here's the relevant section of code:

  mycolors <- c("black", "darkgreen", "red")

  mylines <- Rows(superpose.line, 1:numlines);   mylines$col <- mycolors

  mysymbols <- Rows(superpose.symbol, 1:numlines);   mysymbols$pch <- c(15:18)[1:numlines]
  mysymbols$col <- mycolors

    panel = panel.superpose,
    log10(states) ~ size,

    lwd = 2,

    par.settings = list(superpose.symbol=mysymbols),     ylim=c(y_min, y_max),
    scales = list(tck=c(1, 0), axs="r",
                  x=list(tick.number=(xmax - xmin + 1), at=xmin:xmax,
                  labels=xmin:xmax, cex=1.75),

                  y=list(axs="r", rot=c(90, 0), labels=y_labels,
                         at=y_at, cex=1.75
    key = list (
      text  = list(levels(data$category)),
      lines = list(type="b",
                   cex=rep(1.25, numlines),
      x = .98,
      y = .25,

    xlab = list(label="System Size", cex=2),     ylab = list(label="States", cex=2),

Can anyone help me out with this?



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 Jul 11 03:19:56 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 11 Jul 2006 - 08:15:26 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.