R 是否可以垂直调整减淡条形图中的标签?

R 是否可以垂直调整减淡条形图中的标签?,r,ggplot2,R,Ggplot2,我想降低减淡条形图中标签的高度,使其不在条形图的边缘 我尝试在位置_dodge()中使用height=但由于height不是位置_dodge()中的参数,因此会出现错误“unused argument”。这是我的代码: newdata <- read.table(text = "2010 2018 healthcare 0.09940358 0.09256198 allsectors 0.14713699 0.15306588", sep = " ", header = TRUE) li

我想降低减淡条形图中标签的高度,使其不在条形图的边缘

我尝试在位置_dodge()中使用height=但由于height不是位置_dodge()中的参数,因此会出现错误“unused argument”。这是我的代码:

newdata <- read.table(text = "2010 2018
healthcare 0.09940358 0.09256198
allsectors 0.14713699 0.15306588", sep = " ", header = TRUE)

library(reshape)
datnew <- melt(cbind(newdata, ind = rownames(newdata)), id.vars = c('ind'))
library(ggplot2)
library(scales)
library(dplyr)

ggplot(datnew, aes(x = variable, y = value, fill = ind)) + 
geom_col(position = "dodge", colour = 'black') + 
geom_text(size = 3.5, position = position_dodge(width=1), aes(label = 
scales::percent(value))) + 
scale_x_discrete(labels = c('2010', '2018')) + 
scale_y_continuous(labels = percent_format()) + 
scale_fill_manual(name = "sector" , values = c("brown3", "darkgrey")) +
xlab('Year') + 
ylab('% of workforce') + 
ggtitle('figure 4', subtitle = 'Workers under the age of 25') 
theme_bw() +
theme(plot.title=element_text(lineheight = NULL, hjust=0.5, face="bold", 
color="black", size=16), plot.subtitle = element_text(lineheight = NULL, 
hjust=0.5, color = 'black', size=14), panel.border = element_blank(), 
panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
axis.line = element_line(colour = "black")) + expand_limits(y = 0)

newdata Set
vjust
到负片
geom_文本(大小=3.5,位置=position_道奇(宽度=1),vjust=-5)
Set
vjust
到负片
geom_文本(大小=3.5,位置=position_道奇(宽度=1),vjust=-5)