0
我可以創建帶有錯誤條的條形圖,但是如何將標籤放在較高(vLABELH
)和較低錯誤條(vLABELL
)上。R ggplot在錯誤條上放置標籤
library(ggplot2)
vx <- c(1:5)
vBAR <- c(0.1,0.2,0.3,0.4,0.5)
vLINE1 <- c(0.15,0.25,0.35,0.45,0.55)
vLINE2 <- c(0.15,0.25,0.35,0.45,0.55)
vLINE3 <- c(0.05,0.15,0.25,0.35,0.45)
vLABELL<- c(0.05,0.15,0.25,0.35,0.45)
vLABELH <- c(0.15,0.25,0.35,0.45,0.55)
df1 <- as.data.frame(cbind(vx,vBAR,vLINE1,vLINE2,vLINE3,vLABELL,vLABELH))
class(df1)
barchart1 <- ggplot(df1, aes(x=as.factor(vx),y=vBAR)) + geom_bar(fill="blue", colour="blue")+
geom_errorbar(aes(ymin=vLINE3, ymax=vLINE1))
barchart1
來吧,你肯定不是在SO一個新手。快速[在SO **上搜索](http://stackoverflow.com/search?q= [ggplot] +標籤+酒吧)絕對會讓你進入'geom_text'。請展示一些努力! – Henrik