【发布时间】:2022-07-07 20:09:23
【问题描述】:
我想将条形图上方的值四舍五入到小数点后一位。例如 14 应该是 1.5 而不是 1.52977。
This is how the bar chart looks right now
这是我的代码:
CPUE1 <- CPUE
CPUE1$Strecke <- factor (CPUE1$Strecke, levels = c('30/31', '14', '12', '10','1c','1bc', '1b'))
ggplot(CPUE1, aes(x= Strecke, y= CPUE, fill = Strecke ))+
geom_bar(stat='identity', position = 'dodge')+
theme_minimal()+
geom_text (aes (label = CPUE), position=position_dodge(width=0.9), vjust=-0.25)+
scale_fill_manual (values =
c("12" = "green", "10"= "green",
"1c" = "green", "14"= "red",
"1b"= "red","1bc"= "red","30/31" = "red"))
【问题讨论】:
标签: ggplot2 bar-chart rounding