I have the following in order to bar plot the data frame.
c1 <- c(10, 20, 40)
c2 <- c(3, 5, 7)
c3 <- c(1, 1, 1)
df <- data.frame(c1, c2, c3)
ggplot(data=df, aes(x=c1+c2/2, y=c3)) +
geom_bar(stat="identity", width=c2) +
scale_fill_manual(values=c("#FF6666"))
I end up having only grey bars: Grey bars for bar plot
I would like to change the color of the bar. I already tried different scale_fill_manual from http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/ but still have grey bars.
Thank you for your help.
geom_bar()
:geom_bar(stat="identity", width=c2, color = "#FF6666")
– Evasiveggplot(data=df, aes(x=c1+c2/2, y=c3, fill=c3)) + geom_bar(stat="identity", width=c2)
I then have a blue-ish color filled, but again, I do not get to choose manually. – Recklessgeom_bar(stat="identity", width=c2, fill = "#FF6666")
for same fill for all the bars. Usescale_fill_manual(values=c("#FF6666"))
if you want to set color by a variable (category). – Evasiveggplot(data=df, aes(x=c1+c2/2, y=c3, fill=c3)) + geom_bar(stat="identity", width=c2) + scale_fill_manual(values=c("#FF6666"))
but this gives me the errorError : Continuous value supplied to discrete scale
– Recklessggplot(data=df, aes(x=c1+c2/2, y=c3)) + geom_bar(stat="identity", width=c2, fill = "#FF6666")
which is similar toggplot(data=df, aes(x=c1+c2/2, y=c3)) + geom_bar(stat="identity", width=c2, fill = "red")
– Evasive