Jason Rupert
2009-Feb-04 21:24 UTC
[R] Two issues with ggplot2 - grid.gedit doesn't work from source file & grid.gedit effects are not preserved
Code for this post is shown below.
Two issues:
(1) grid.gedit doesn't work from source file
Reproduce - copy the code shown below into an R source file, and of course save
off in the appropriate location. Then copy the the first line
"source("C:/TestCode.R")" into R and run. Notice that you
get the following error:Error in editDLfromGPath(gPath, specs, strict, grep,
global, redraw) :
'gPath' (text) not found
Now however, copy the below into R and runn it all. Notice that the code runs
to completion. Is this expected? Is there a fix?
(2) grid.gedit effects are not preserved
After completing (1). Navigate to the location of the output and open
TestCode.pdf. Notice that the PDF does not preserve the requested RED font. Is
this expected? Is there a work around? Should a different publishing type be
used to preserve the grid.gedit change?
# source("C:/TestCode.R")
VADeaths_flat_df = stack(as.data.frame(VADeaths))
names(VADeaths_flat_df) = c('Data','Person')
counts <- ddply(VADeaths_flat_df, .(cut(Data, breaks=fullseq(range(Data),
20)), Person), nrow)
names(counts) <- c("bin", "person", "n")
qplot(person, n, data = counts, fill = person, geom="bar",
stat="identity", width = 0.9) + facet_grid(. ~ bin) +
opts(axis.text.x = NULL)
grid.gedit("text", gp = gpar(fontsize=14, col="red"))
# Formatting seems to work better for the PDF plot.
Test_title<-paste("C:/TestCode.pdf", sep = "")
ggsave(file=Test_title)
[[alternative HTML version deleted]]
