[edit 3] At this point, it is possible for me to use the commands:
library(Cairo)
CairoPNG("test.png")
pie( 1:10, labels=paste("label number",1:10))
dev.off()
to obtain the same figure quality.
Someone with apparently the same problem: http://r.789695.n4.nabble.com/Two-questions-on-R-and-cairo-Cairo-td2318527.html
I am wondering why do I obtain different results from the same command using Rstudio, Rscript or just the R console from a terminal. The code I am using is quite clear:
png(filename = "test.png")
pie( 1:10, labels=paste("label number",1:10))
dev.off()
Image obtained using Rscript or the R command prompt from a terminal. (cmd: Rscript script.R )
[edit 1] When checking the files I produce, I actually have different size and properties:
4,5K test.Rscript.png: PNG image data, 480 x 480, 8-bit colormap, non-interlaced
26K test.Rstudio.png: PNG image data, 480 x 480, 8-bit/color RGB, non-interlaced
[edit 2 : Here I need some more help] Answer from the comment from sinQueso: The result of
Rscript -e 'getOption("bitmapType"); capabilities("cairo");'
"Xlib"
cairo
FALSE
From Rstudio, I got:
getOption("bitmapType"); capabilities("cairo");
"cairo"
cairo
TRUE
I checked, I just can not load cairo using the following commands:
Error in library(Cairo) : there is no package called ‘Cairo’
Error in library(cairoDevice) : there is no package called ‘cairoDevice’
(libcairo2-dev is installed)
So I tried:
install.packages('Cairo')
from R console, but even if I load the Cairo, I am apparently still using the Xlib.
sessionInfo: The only difference: tools_3.3.2 is loaded in RStudio