我正在使用ggplot2繪製包含九個構面的圖。每個方面代表兩個變量之間的關係,我想用明星''來標註顯示統計顯着結果的方面。這會導致只有兩個''的九個方面。但是,我最終將顯示註釋的所有九個方面。使用ggplot2創建facet_wrap圖,註釋少於註解
我該如何解決這個問題?
library(ggplot2)
Sig<-c("","*","","","","","","*","") # Only the second and the second to last facets should receive significance stars.
Data.annot<-data.frame(unique(Aspects),Sig)
qplot(Labels,Es,data=Data1) + geom_pointrange(aes(x=Labels,y=Es,ymin=Low,ymax=Up)) + geom_hline(yintercept=0, linetype="dashed") + coord_flip() + facet_wrap(~Aspects, scales="free") + geom_text(data=Data.annot, aes(x= 0.5, y= 1, label = Sig)) + scale_y_continuous("Correlation coefficient\n(effect size)",limits=c(-0.5,1),breaks=c(-0.5,0,0.5,1.0)) + scale_x_discrete("")
這似乎與這個佇列相似。你檢查過了嗎? http://stackoverflow.com/questions/2050610/creating-a-facet-wrap-plot-with-ggplot2-with-different-annotations-in-each-plot – Brani 2010-04-14 09:03:42
我檢查了一個,但無法適應我的需要。當我繪製時,符號仍然出現在所有方面 – EduardoSAS 2010-04-15 06:29:26