I've been asked by my boss to replace the "0"'s above my bar labels with "n/a" for publication purposes.
The code I ran:
geom_text(aes(label = round(variable, digits = 0), , vjust = -0.5, colour = "black")
What I get:
I've been asked by my boss to replace the "0"'s above my bar labels with "n/a" for publication purposes.
The code I ran:
geom_text(aes(label = round(variable, digits = 0), , vjust = -0.5, colour = "black")
What I get:
Here's an example using built in data:
library(tidyverse)
labeldata=data.frame(cut=c('Fair','Good','Very Good','Premium','Ideal'),
table=c(NA,300000,750000,900000,1250000),
label=as.character(c(0,300000,750000,900000,1250000))) %>%
mutate(table=ifelse(is.na(table),0,table))
labeldata
ggplot(data = diamonds) +
geom_col(aes(x=cut,y=table)) +
geom_text(data = labeldata,
aes(x=cut,y=table,label=label))