It's possible to overlap an external image (jpg or pdf) with a plot generated with R? Specifying the image as the background of the plot might not be possible... any idea? thanks Meinhard Ploner
On Wed, 21 May 2003, Meinhard Ploner wrote:> It's possible to overlap an external image (jpg or pdf) > with a plot generated with R? > > Specifying the image as the background > of the plot might not be possible...Although this has been discussed, R graphics devices cannot as yet plot bitmap images. So all one can do is to plot a set of rectangles: for that the pixmap package might be helpful. Although we might add the ability to plot a bitmap image, note that it is not straightforward, as R screen graphics devices can be dynamically resized. What should be done with a plotted image then? Interpolate on the fly? -- 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
Meinhard Ploner wrote:> It's possible to overlap an external image (jpg or pdf) > with a plot generated with R? > > Specifying the image as the background > of the plot might not be possible... >If the plot is output using postscript(), the default background color is transparent. For instance, if you have a plot produced with postscript(...,onefile=FALSE,...) named Rplots.ps, you can insert the following lines in another Postscript file to get the plot overlaid on whatever image is in that file. ... %%DocumentNeededFiles: /home/jim/analyses/Rplots.ps ... gsave x y translate x y scale (/home/jim/R/analyses/Rplots.ps) run grestore ... the "translate" and "scale" commands allow you to place the plot where you want it and get the correct size. It's not too hard, but it helps if you have had some experience with Postscript. Once you have gotten the translate and scale factors right (Ghostview is a great help) you can just keep plugging your plots in unless you want to change the image size. Jim