[R] trouble getting b&w plots using trellis graphic
Deepayan Sarkar
deepayan.sarkar at gmail.com
Fri Apr 13 03:46:17 CEST 2007
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
More information about the R-help
mailing list