[R-SIG-Mac] [R] Bug with the col option in plot function
Duncan Murdoch
murdoch at stats.uwo.ca
Sat Mar 21 16:03:19 CET 2009
On 21/03/2009 10:44 AM, heyi xiao wrote:
>
>
>
> Thanks, David,
>
> utils::str(pdf.options()) returns exactly the same results
> as yours. The colormodel is set to rgb already.
>
> The reason I thought this is a bug is that the same plot function
> + col option works fine when pch=0 or other numbers, except for 1 or 16 (empty or
> solid circle) or any letter. Therefore, I have reason to believe that this is
> not something related to general plotting setting. And also I reproduced the
> same problem in different versions of R (both 2.4 and 2.8). Therefore, I don’t
> think this is a problem with my specific R version.
Have you tried viewing the pdf file in another viewer, e.g. Acrobat?
Preview in MacOS 10.4 had a number of bugs in it; there are fewer in
10.5, I think.
Duncan Murdoch
>
> Heyi
>
>
>
> --- On Fri, 3/20/09, David Winsemius <dwinsemius at comcast.net> wrote:
> From: David Winsemius <dwinsemius at comcast.net>
> Subject: Re: [R] Bug with the col option in plot function
> To: xiaoheyiyh at yahoo.com
> Cc: "r-help at r-project.org Help" <r-help at r-project.org>, "R-SIG-Mac Mailing List" <r-sig-mac at stat.math.ethz.ch>
> Date: Friday, March 20, 2009, 7:45 PM
>
> 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
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-SIG-Mac
mailing list