add a smoothed line to barplot with ggplot
I was wondering whether it is possible to add a geom_smooth (or any trend-line) to a geom_col barplot in ggplot2. Here is the code I’m using: library(dplyr) library(readxl) library(ggplot2) library(RColorBrewer) mapQ_prop <- read_excel("/path/to.file.xlsm", 16) mapQ_prop <- mapQ_prop %>% arrange(value) mapQ_prop$sample <- as.vector(mapQ_prop$sample) mapQ_prop$sample = factor(mapQ_prop$sample,mapQ_prop$sample) plot_mapQ <- ggplot(data=mapQ_prop, aes(x=sample, y=value, fill=brewer.pal(9, "Blues")[5])) + geom_col(color="black", alpha=.75)… Read More add a smoothed line to barplot with ggplot