I would like to add specific items to the x-axis as empty bars in a bar plot
For example:
# load packages
library(reshape2)
library(tidyverse)
library(scales)
#get data
data(tips, package = "reshape2")
tips
# make plot
myplot <- ggplot(tips, aes(day, group = sex)) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count") +
scale_y_continuous(labels=scales::percent) +
ylab("relative frequencies") +
facet_grid(~sex)
myplot
now I would like to add the missing week days, as empty bars:
missing_days <-c("Tue","Wed")
If possible, I would like to keetp the "tidy" long data format of tips
(so that I can still use other variables in the aes
command.
What does the trick to add "empty" items to a long data format?