I found similar questions online, however I seem to be having problems because I am already using fill to color the rest of the bars in the histogram; So when I try to add a manual command to color that separate bar, it overrides it and produces an error.
Here is my ggplot code. I added a column called X$Test that has a single TRUE value at indel_size = 0 where I want to color the bar... Below is the main code, then after that is what I have tried
ggplot(data=X, aes(x=indel_size, y=Fq2, fill = indel_size))+
geom_bar(stat="identity")+
scale_fill_gradient2(low="dodgerblue", mid="royalblue", high = "royalblue4")+
ylab("Indel Frequency")+
theme(axis.line = element_line(colour = "black"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank())+
scale_color_continuous(labels = c(-5, 0, 5))+
scale_x_continuous(name = "Indel Size", limits = c(-50,10),
breaks = seq(from = -50, to = 10, by = 10))+
scale_y_continuous(name = "Indel Frequency", limits = c(0,0.5))
Here is the command I tried:
+scale_fill_manual(values = 0, aesthetics = c("red", "fill"))
With the error:
Scale for 'fill' is already present. Adding another scale for 'fill', which will
replace the existing scale.
Error: Continuous value supplied to discrete scale
In addition: Warning message:
Removed 74 rows containing missing values (position_stack).
Thanks!