I'm having trouble getting a black and white plot using the trellis device. I have color graphics, but I'd like to use b&w for a paper. For example, trellis.device(color=F) d <- read.table(textConnection(" A,B 0,1 1,2"), header=T, sep=",") xyplot(A ~ B, data=d, type="o", lty=c(1:2), col=2, pch=19:20) dev.off() gives me a red line even though I specify color=F.>sessionInfo()R version 2.4.1 (2006-12-18) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods" [7] "base" other attached packages: lattice "0.14-17" Thank you, Brian _________________________________________________________________ Need a break? Find your escape route with Live Search Maps.
On 4/12/07, Brian Riordan <bwriordan at hotmail.com> wrote:> I'm having trouble getting a black and white plot using the trellis device. > I have color graphics, but I'd like to use b&w for a paper. For example, > > trellis.device(color=F) > d <- read.table(textConnection(" > A,B > 0,1 > 1,2"), header=T, sep=",") > xyplot(A ~ B, data=d, type="o", lty=c(1:2), col=2, pch=19:20) > dev.off() > > gives me a red line even though I specify color=F.Yes, the 'color' argument controls the default settings. If you don't want a non-default color, don't specify a color. You can't expect to say "draw these points in red" and then be surprised when the points are really drawn in red. If you expected that somehow col=2 would become a black and white color, then look at ?palette. For example, you can set the palette to shades of grey using palette(grey.colors(5)) -Deepayan