2015-04-12 64 views
4

如何注释奇数分面ggplot内空白区域的一些文本。 让我们有一个分面ggplot与数据如下与2行和2列。所以有2个空格,2个空格。如何将注释文本置于分面ggplot的空白区域

df<- data.frame(Ara = rep("XTX", each = 3), 
       Len = c(744, 750, 755), 
       Mon = c("Sep", "Oct","Nov"), 
       Value=c(11.224,10.15,4.23)) 
    df 
    facetplot<-ggplot(df, aes(x=Value, y=Len, shape=Ara))+ 
     geom_point(size=5.0)+ 
     theme(legend.position = c(.7, .4), legend.direction="vertical")+ 
     facet_wrap(~Mon,scales="free_x", nrow=2) 
    facetplot 

enter image description here 我现在想标注在空间中的一些文本,但不能(写在红色的图像)。我正在寻找类似legend.position的注释文本。有没有人对此有任何想法。或者可能的解决方案是什么。 谢谢。

+0

这是[类似问题](http://stackoverflow.com/questions/10014187/displaying-text-below-the-plot-generated-by-ggplot2)。 –

回答

7

后您创建的情节,简单地使用

print(facetplot) 
grid.text("your text", x = 0.75, y = 0.25) 

有关放置详见?grid.text。默认坐标系是整个屏幕设备,(0,0)为左下角,(1,1)为右上角。

+0

谢谢你回答这个问题。我尝试了你的建议,但它给出了一个错误“错误:不知道如何将o添加到情节”。任何建议来解决这个问题。 – Cirrus

+0

从命令行执行'print(facetplot)'后,执行'grid.text'命令。这是一个完全独立的步骤。 –

+0

谢谢,那是不可思议的!!!!!!!! – Cirrus

相关问题