[R] Problem with grid.rect

Bert Gunter gunter.berton at gene.com
Thu Sep 27 19:42:01 CEST 2012


(Sorry, forgot to cc to the list)

-- Bert

On Thu, Sep 27, 2012 at 10:41 AM, Bert Gunter <bgunter at gene.com> wrote:
> Perrick:
>
> You have an a extra ")" after yscale =
> so the pushViewport statement is ignored and the rest does what you ask it to.
>
> -- Bert
>
> On Thu, Sep 27, 2012 at 9:39 AM, Pierrick Bruneau <pbruneau at gmail.com> wrote:
>> I have a stupid problem that is currently driving me crazy...
>> Let us suppose that I want to draw a big red square in the middle of my
>> current device (say X11)
>>
>> I tried the following code :
>>
>> pushViewport(viewport(xscale=c(0,1), yscale=c(0,1)), just=c("center", "center"))
>> vp1 <- viewport(x=unit(0.5, "native"), y=unit(0.5, "native"),
>> width=unit(0.4, "native"), height=unit(0.4, "native"),
>> just=c("center", "center"))
>> grid.rect(x=unit(0, "snpc"), y=unit(0, "snpc"), width=unit(1, "snpc"),
>> height=unit(1, "snpc"), gp=gpar(col=rgb(0.9, 0, 0), fill=rgb(0.9, 0,
>> 0), just=c("center", "center")), vp=vp1)
>>
>> (I know I could do this in a simpler way, but let's suppose I want to go
>> through the pushviewport / viewport def / grid.rect with vp argument
>> sequence)
>> I must be missing something obvious ! What am I doing wrong ?
>> Thanks by advance for your help.
>>
>> Pierrick Bruneau
>> CRP Gabriel Lippmann
>>
>>         [[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.
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm




More information about the R-help mailing list