[R] Bug with the col option in plot function

David Winsemius dwinsemius at comcast.net
Sat Mar 21 00:45:33 CET 2009


Really belongs o R-SIG-Mac list and have copied it there. I cannot  
reproduce on my Mac. I get the same colors on the pdf file with that  
code as I do on the screen device. I have in in the past needed to set  
up a device before plotting:
trellis.device(device="postscript", color = TRUE)  ... but you are not  
using a trellis function or creating postscript.

What does  utils::str(pdf.options()) return?
On mine I get this
List of 15
  $ width      : num 7
  $ height     : num 7
  $ onefile    : logi TRUE
  $ family     : chr "Helvetica"
  $ title      : chr "R Graphics Output"
  $ fonts      : NULL
  $ version    : chr "1.4"
  $ paper      : chr "special"
  $ encoding   : chr "default"
  $ bg         : chr "transparent"
  $ fg         : chr "black"
  $ pointsize  : num 12
  $ pagecentre : logi TRUE
  $ colormodel : chr "rgb"
  $ useDingbats: logi TRUE


Perhaps this could be a cure?:
  pdf.options(colormodel = "rgb")

You probably ought to update as well before raising the bug-flag.

-- 
David Winsemius, MD
Heritage Laboratories
West Hartford, CT


 > sessionInfo()
R version 2.8.1 Patched (2009-01-19 r47650)
i386-apple-darwin9.6.0

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets   
methods   base

other attached packages:
[1] termstrc_1.1    Design_2.1-2    Hmisc_3.5-2     survival_2.34-1

loaded via a namespace (and not attached):
[1] cluster_1.11.12 grid_2.8.1      lattice_0.17-20 tools_2.8.1
On Mar 20, 2009, at 6:47 PM, heyi xiao wrote:

>
>
>
>
> I lose control on colors when I plot points with pch=1 or 16
> (empty or solid circle) or any letter, say "A". For example:
>
>
>
> x=runif(5)
>
> y=runif(5)
>
> pdf("plot.pdf")
>
> plot(x, y,
> type='p', pch=1, col = 1:5) #just black points
>
> plot(x, y,
> type='p', pch=0, col = 1:5) #points with different colors
>
> dev.off()
>
>
>
> This problem occurred for different versions of R under Mac
> OS X 10.4. not sure whether this is true for other operating  
> systems. I used my
> most basic settings of R without any special package loaded. Any  
> suggestions/ideas
> would be appreciated.
>
>
>
>> sessionInfo()
>
> R version 2.8.0 (2008-10-20)
>
> powerpc-apple-darwin8.11.1
>
>
>
> locale:
>
> C
>
>
>
> attached base packages:
>
> [1] stats     graphics
> grDevices utils     datasets  methods
> base




More information about the R-help mailing list