Chris Brien
unread,Oct 25, 2012, 9:11:56 PM10/25/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggp...@googlegroups.com
Hi all,
I am adding to lines of text to the last facet of a facet_grid plot and I get 4 warning messages saying that "NAs introduced by coercion".
The code for the plot is below and the plot that is produced looks fine. It is just the annoying warnings that do not appear if I remove the geom_text geoms. Any suggestions as to why I am getting these messages?
Cheers,
Chris
x.lev <- levels(Sources)
annot <- data.frame(Inf, -Inf, factor(x.lev[length(x.lev)], levels = x.lev))
names(annot) <- c("xDay", "backtransformed.predictions", "Sources")
windows()
pred.plot <- ggplot(data=backtransforms,
aes_string(x = x.var, y = "backtransformed.predictions")) +
scale_colour_manual(values=cbPalette) +
scale_shape_manual(values=symb) +
scale_x_continuous(x.title) +
scale_y_continuous(y.title) +
layer(geom = "line", colour = cbPalette[1]) +
layer(geom = "point", shape = symb[7]) +
facet_grid(~ Sources)
pred.plot <- pred.plot + geom_ribbon(aes(ymin=lower.confidence.limit, ymax=upper.confidence.limit),
alpha=0.2, fill="blue", show_guide=FALSE) + scale_fill_hue() +
geom_text(data = annot, label = "Error bars are",
hjust=1, vjust=-1.3, size = 2) +
geom_text(data = annot, label = "confidence intervals",
hjust=1, vjust=-0.3, size = 2)
pred.plot