Dear group,
As a follow-up, here is a reproducible example (Kohske's code - thanks Dennis).
library(ggplot2)
df <- data.frame(x = rep(1:100, times=7),
facet_var = as.factor(rep( 1:7, each=100)),
y = runif(7*100)
)
# label for marginal plot
df <- rbind(df, data.frame(x = NA, y = NA, facet_var = "Boxplot wow"))
p <- ggplot(data = df, aes(x, y)) +
geom_line() + facet_wrap( ~ facet_var, ncol=2) +
# set limits for adjustment
coord_cartesian(xlim = c(0, 100))
xdata <- runif(1000, min = 20, max = 80)
boxdf <- data.frame(x=xdata, group=rep(1,length(xdata)))
q <- ggplot(data = boxdf, aes(as.factor(group),x)) + geom_boxplot() +
# set breaks and limits for adjustment
coord_flip(ylim = c(0, 100)) + labs(x=NULL) +
scale_y_continuous(breaks = 1:5*20) +
#opts for full region drawing:
opts(
legend.position = "none",
panel.margin = unit(0,"null"),
plot.margin = rep(unit(0,"null"),4),
axis.ticks = theme_blank(),
axis.text.x = theme_blank(),
axis.text.y = theme_blank(),
axis.title.x = theme_blank(),
axis.title.y = theme_blank(),
axis.ticks.length = unit(0,"null"),
axis.ticks.margin = unit(0,"null")
)
print(p)
# remove unused panel
grid.remove("panel-14-5")
downViewport("panel-14-5")
print(q, newpage=F)
It is the three bottom lines that do not work with R version 2.15.2 with ggplot2_0.9.3. I have replaced them with
grid.remove("panel-8.16-7-16-7")
downViewport("panel-8.16-7-16-7")
but then I get the error
Error in grid.Call.graphics(L_downviewport, name$name, strict):
Viewport 'panel-8.16-7-16-7' was not found.
Any ideas as to how to successfully replace the panel? Thanks in advance for your help!
Kim