누적 막대에 백분율 수치를 표시하고 싶습니다. 그러나 한 그룹의 비율은 매우 낮습니다. 두 값이 서로 겹치고 있습니다. 나는 'postion ='identity '로 바뀐다. 아직도 ..... 모든 생각은 작동하지 않을까요?geom_text를 사용하여 누적 막 대형 차트의 값을 표시하는 방법은 무엇입니까?
x4.can.m <- structure(list(canopy = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 1L,
2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), .Label = c("0%", "1 to 84%",
"85% +"), class = "factor"), YearQuarter = structure(c(1L, 1L,
1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L), .Label = c("2011-09-01",
"2011-12-01", "2012-03-01", "2012-06-01", "2012-09-01"), class = "factor"),
value = c(0.51, 0.01, 0.48, 0.52, 0.01, 0.47, 0.53, 0.01,
0.47, 0.57, 0.01, 0.41, 0.61, 0.01, 0.38)), .Names = c("canopy",
"YearQuarter", "value"), row.names = c(NA, -15L), class = "data.frame")
x4.can.bar <- ggplot(data=x4.can.m, aes(x=factor(YearQuarter), y=value,fill=canopy)) + geom_bar(stat="identity",position = "stack",ymax=100)
x4.can.bar+scale_y_continuous(formatter='percent')+
labs(y="Percentage",x="Year Quarter") +
geom_text(aes(label =paste(round(value*100,0),"%",sep="")),size = 3, hjust = 0.5, vjust = 4,position ="identity")
난 당신의 솔루션을 선호합니다. – agstudy
@mnel, 감사합니다. ggplot2_0.9.2.1로 업그레이드하는 가장 쉬운 방법은 무엇입니까? 나는 R_2.15.1을 여전히 사용하고있다 ..... –
새로운 R 세션에서'install.packages ('ggplot2') '를 실행한다 – mnel