Pass position of geom_text
on y axis with y = Value + 2 * sign(Value)
library(ggplot2)
ggplot(dat, aes(Types, Value)) +
geom_bar(stat = "identity" ,color = "#FFFFFF" , fill = "dodgerblue3") +
geom_text(aes(y = Value + 2 * sign(Value), label = Value),
position = position_dodge(width = 0.9),
size = 3.5 , angle = 90)
Another plot with minor visual tweaks that I do on my plots:
As you have numbers with bars you don't need y-axis (it's redundant).
ggplot(dat, aes(Types, Value)) +
geom_bar(stat = "identity", color = "black" , fill = "grey",
size = 0.7, width = 0.9) +
geom_text(aes(y = Value + 2 * sign(Value), label = Value),
position = position_dodge(width = 0.9),
size = 5) +
theme_classic() +
theme(axis.text.x = element_text(size = 12),
axis.title = element_text(size = 20),
axis.text.y = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank())
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…