[R] Using grImport to create a watermark

2012-12-28 Thread Thomas Adams - NOAA Federal
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
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


-- 

Thomas E Adams

Development  Operations Hydrologist
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

http://www.erh.noaa.gov/er/ohrfc/

EMAIL:  thomas.ad...@noaa.gov
VOICE:  937-383-0528
FAX:937-383-0033

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Using grImport to create a watermark

2012-12-28 Thread Prof Brian Ripley
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@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,  rip...@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, UKFax:  +44 1865 272595

__
R-help@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.


Re: [R] Using grImport to create a watermark

2012-12-28 Thread Thomas Adams - NOAA Federal
Prof Ripley,

I see that now; I can get the transparency to work, but even with using
pdf() my plot still does not draw if I first use:

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)))

Regards,
Tom


On Fri, Dec 28, 2012 at 1:55 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote:

 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.pdfhttp://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@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  
 http://www.stats.ox.ac.uk/~**ripley/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, UKFax:  +44 1865 272595

 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 

Thomas E Adams

Development  Operations Hydrologist
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

http://www.erh.noaa.gov/er/ohrfc/

EMAIL:  thomas.ad...@noaa.gov
VOICE:  937-383-0528
FAX:937-383-0033

[[alternative HTML version deleted]]

__
R-help@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.