You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It used to be possible to put text outside of the plots by turning off the clipping. This doesn't seem to be possible anymore in plots that use facets (but still works if no facets are used). It would be great if this could be fixed such that it's possible to put text outside of plots even when using facets.
Here is a minimal working example:
library(ggplot2)
library(grid)
df.plot = data.frame(x = 1, y = 1, facet = 'facet', stringsAsFactors = F)
df.text = data.frame(x = 1, y = -0.3, label = 'test', facet = 'facet', stringsAsFactors = F)
p = ggplot(df.plot,aes(x = x, y = y))+
facet_grid(~facet)+ # 'test' is only printed outside of the plot if faceting is turned off
geom_point()+
geom_text(data = df.text,aes(x=x,y=y,label=label))+
coord_cartesian(xlim = c(0, 2),ylim=c(0,2),expand=F)+
theme(plot.margin=unit(c(2,2,2,2),"cm"))
gt = ggplot_gtable(ggplot_build(p))
gt$layout$clip[gt$layout$name=="panel"] = "off"
grid.draw(gt)
The text was updated successfully, but these errors were encountered:
It used to be possible to put text outside of the plots by turning off the clipping. This doesn't seem to be possible anymore in plots that use facets (but still works if no facets are used). It would be great if this could be fixed such that it's possible to put text outside of plots even when using facets.
Here is a minimal working example:
The text was updated successfully, but these errors were encountered: