[R] two issues

Deepayan Sarkar deepayan at stat.wisc.edu
Thu Feb 3 21:14:21 CET 2005


On Thursday 03 February 2005 13:52, Dean Sonneborn wrote:
> I'm working on a graphic but have run into a road block about two
> issues.  I don't have a color printer so I want to produce the
> graphic in black and white. I'm currently using this
> statement  trellis.device(bg="white")  

Doesn't that give you a warning? If not, you are using an older version 
of R (earlier than 2.0.0). In the latest version, ?trellis.device has a 
long rant on this issue.

> but the body of the graphic 
> contains color. What is the code to create the whole thing in black
> and white. 

If you want black and white, simply use 

trellis.device(color = FALSE)

> The other issue might be a bit more tricky. I'm using this 
> statement: auto.key=TRUE  and in the body of the graphic I'm getting
> two different symbols and on the screen I see two symbols in the key
> but when I print it the key only contains one symbol for both!

auto.key only works if you use the default plotting symbols, it doesn't 
know that you have specified pch=1:2. The easiest way to handle this 
would to replace 'pch=1:2' by 

'par.settings = list(superpose.symbol = list(pch = 1:2))'

(which may not work if your version of R is too old).

Deepayan

> here's the whole R code statement:
> dotplot(chemical~adjlogmle| convert*tdnew, data=allrisk ,
> group=rodentx, main="Interspecies Conversion", pch=1:2,
> auto.key=TRUE, scales = list(tick.number=10), fontfamily =
> "HersheySans")
>
> Thanks,
>
> Dean Sonneborn M.S.
> Public Health Sciences *
> University of California, Davis
> 916 734-6656
>
> * formerly Epidemiology & Preventive Medicine




More information about the R-help mailing list