[R] RGtk2 drawing area as cairo device - no points
François Rebaudo
francois.rebaudo at legs.cnrs-gif.fr
Fri Sep 19 09:32:17 CEST 2014
Thanks !
Just in case it could be of any help, this is what I have done for MS
Windows users :
library(RGtk2)
library(cairoDevice)
win = gtkWindow(show = FALSE)
win$setDefaultSize(500, 500)
hbox<-gtkHBoxNew(homogeneous=FALSE, spacing=0)
if (Sys.info()[1]=="Windows"){
png(filename="temp.png", width = 500, height = 500)
layout(matrix(c(1,1,2,3),2,2,byrow=TRUE))
par(mar=c(4,4,1,1))
plot(1:10) #boxplot(1:10)
plot(1:10)
plot(1:10)
dev.off()
myPLOT<-gtkImage(filename= paste(getwd(),"/temp.png",sep=""))
hbox$add(myPLOT)
win$add(hbox)
win$showAll()
} else {
da = gtkDrawingArea()
asCairoDevice(da)
hbox$packStart(da, expand = TRUE, fill = TRUE, padding = 0)
win$add(hbox)
win$showAll()
layout(matrix(c(1,1,2,3),2,2,byrow=TRUE))
par(mar=c(4,4,1,1))
plot(1:10) #boxplot(1:10)
plot(1:10)
plot(1:10)
}
Le 19/09/2014 01:01, Michael Lawrence a écrit :
> Just wanted to acknowledge this. It's a known issue, and one that has
> been tricky to solve, because it's platform-specific, so it's probably
> some sort of bug in the abstraction (GDK).
>
> On Wed, Sep 17, 2014 at 12:26 AM, FR wrote:
>
> Hi,
> The following code adapted from Michael post
> (https://stat.ethz.ch/pipermail/r-help/2012-March/306069.html)
> works just fine on Linux Debian, but not on Windows 7 (no points
> on plots 2 and 3). More surprisingly, if the
> first plot is a boxplot, it works on both OS... and if I do a pdf
> (using pdf()), I get my points... Thanks in advance for your
> help.
>
> library(RGtk2)
> library(cairoDevice)
> win = gtkWindow(show = FALSE)
> win$setDefaultSize(500, 500)
> da = gtkDrawingArea()
> asCairoDevice(da)
> win$add(da)
> win$showAll()
> layout(matrix(c(1,1,2,3),2,2,byrow=TRUE))
> par(mar=c(0,0,0,0))
> plot(1:10) #boxplot(1:10)
> plot(1:10)
> plot(1:10)
>
> sessionInfo()
>
> R version 3.1.0 (2014-04-10)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
> [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
> [5] LC_TIME=French_France.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> loaded via a namespace (and not attached):
> [1] tools_3.1.0
>
> ______________________________________________
> R-help at r-project.org <mailto: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.
>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list