0
我試圖將文本打印限制爲條形圖中的一個變量。我該如何標籤粉色欄601, 215, 399, 456
?在ggplot2中僅顯示一個文本值
ggplot(df, aes(Var1, value, label=value, fill=Var2)) +
geom_bar(stat="identity", position=position_dodge(width=0.9)) +
geom_text(position=position_dodge(width=0.9))
structure(list(Var1 = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 3L,
4L, 1L, 2L, 3L, 4L), .Label = c("Zero", "1-30", "31-100", "101+"
), class = "factor"), Var2 = structure(c(1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 3L, 3L, 3L, 3L), .Label = c("Searches", "Contact",
"Accepts"), class = "factor"), value = c(21567, 215, 399, 456,
13638, 99, 205, 171, 5806, 41, 88, 78)), .Names = c("Var1", "Var2",
"value"), row.names = c(NA, -12L), class = "data.frame")