Joris Meys
2011-Feb-15 14:48 UTC
[Rd] Using rasterImage on a CairoWin device prevents adding further elements to device?
I was pointed to the Cairo package for plotting PNG images on a device. I've been playing around with it, but found that after I use the rasterImage function, I can't add anything any more to the device, eg : img <- readPNG(system.file("img", "Rlogo.png", package="png")) r = as.raster(img[,,1:3]) r[img[,,4] == 0] = "white" CairoWin() plot(1:2,1:2,type="l") rasterImage(r,1,1,2,2) points(seq(1,2,by=0.1),seq(2,1,by=-0.1),col="black") The points are not plotted anymore. If I use the normal plotting device, I see the points plotted on top of the image. Cheers Joris -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 Joris.Meys at Ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
Simon Urbanek
2011-Feb-15 22:05 UTC
[Rd] Using rasterImage on a CairoWin device prevents adding further elements to device?
Joris, I have added raster support only recently (last week ;)) and there was a bug causing what you see. I have fixed it now so Cairo 1.4-7 will have the fix. Thanks, Simon On Feb 15, 2011, at 9:48 AM, Joris Meys wrote:> I was pointed to the Cairo package for plotting PNG images on a > device. I've been playing around with it, but found that after I use > the rasterImage function, I can't add anything any more to the device, > eg : > > img <- readPNG(system.file("img", "Rlogo.png", package="png")) > r = as.raster(img[,,1:3]) > r[img[,,4] == 0] = "white" > > CairoWin() > plot(1:2,1:2,type="l") > rasterImage(r,1,1,2,2) > points(seq(1,2,by=0.1),seq(2,1,by=-0.1),col="black") > > The points are not plotted anymore. > > If I use the normal plotting device, I see the points plotted on top > of the image. > > Cheers > Joris > > > -- > Joris Meys > Statistical consultant > > Ghent University > Faculty of Bioscience Engineering > Department of Applied mathematics, biometrics and process control > > tel : +32 9 264 59 87 > Joris.Meys at Ugent.be > ------------------------------- > Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php > >