Error with panel.margin

250 views
Skip to first unread message

abi...@sent.com

unread,
Nov 11, 2012, 7:29:25 AM11/11/12
to ggp...@googlegroups.com
Good day All,

The following code throws an error when using panel.margin.
It works fine otherwise.

I was just trying to get more white space between facets.

Any hint on what I am doing wrong appreciated,

Thanks, JL

>
indivplot <- function (x){ + p <- ggplot(subset(zm, subj == x ), aes(daycycle, value)) + p + geom_point(aes(x=daycycle,y=value, colour = ovul), size= 3) + + facet_grid(variable~., scales="free_y") + + scale_x_continuous(breaks = seq(3, 40, 5),limits=c(3, 40) ) + + labs(title= paste("Subject", as.character(x), sep=":")) + + theme(plot.title = element_text(colour = "blue"), panel.margin = unit(2, "lines"), + strip.text = element_text(colour = "blue", size = 14, + face = "bold.italic", hjust = 0.5, vjust = 0.5)) + + ggsave(file=paste("subject", as.character(x),"pdf", sep=".")) + } > z <- w[!is.na(w$site),] > zm <- melt(z, id.vars= c("subj", "site", "daycycle", "ovul" ), + measure.vars = c("folsiz", "estro", "progest", "hooghra")) > allsubj <- as.list(unique(w$subj)) > lapply(allsubj,indivplot) Erreur dans theme(plot.title = element_text(colour = "blue"), panel.margin = unit(0, : impossible de trouver la fonction "unit"

Brandon Hurr

unread,
Nov 11, 2012, 8:03:19 AM11/11/12
to abi...@sent.com, ggplot2
library(grid)

ggplot2 no longer loads many packages that it once did. The unit() function is in the grid package. 

Brandon


--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

igreg

unread,
Nov 11, 2012, 8:06:17 AM11/11/12
to ggp...@googlegroups.com
the "unit" function is - as far as i know - part of the grid package
 
please try:
 
library (grid)
 
best, greg

abi...@sent.com

unread,
Nov 11, 2012, 8:26:49 AM11/11/12
to ggp...@googlegroups.com
Thank you Greg and Brandon.
Reply all
Reply to author
Forward
0 new messages