[R] Using grImport to create a watermark

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Dec 28 19:55:39 CET 2012


I suspect you need a device supporting translucency: PostScript does not 
and hence postscript() cannot.  Try the pdf() device (and convert the 
output if you need it).

On 28/12/2012 17:23, Thomas Adams - NOAA Federal wrote:
> Hi…
>
> I want to use grImport to create a watermark on a plot() using the methods
> Paul Murrell describes here:
> http://cran.r-project.org/web/packages/grImport/vignettes/import.pdf (page
> 28). I can essentially reproduce this manually at the R prompt, and

On what OS and what device: see the posting guide ....

> independently I can use grid.picture(…) successfully in a R script, but
> when I attempt to do do this in my script:
>
>>>> postscript(outputFilename,paper="us")
>
> grid.picture(noaalogo,distort=FALSE,width=0.5,x=0.50,y=0.50)
> grid.rect(gp=gpar(fill=rgb(1,1,1,0.9)))
>
>
> plot(dat,xaxt="n",type="b",ylim=c(y_range[1],y_range[2]),main=labelStr,xlab="Date",ylab="Elevation,
> NAVD88 (Ft)")
>>>> dev.off()
>
> The picture "noaalogo" is drawn, but either the plot() is obscured or is
> not drawn at all. In either case, the "watermarking" effect is not
> happening in my script, but does work as expected, manually, at the R
> prompt. I'm sure this is a graphics device related issue, but I have not
> been able to find a solution through my searches.
>
> Thank you,
> Tom
>
>
>
>
> ______________________________________________
> 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.
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list