1

I've plotted two bar graphs on top of each other using the following:

library(ggplot2)
library(reshape2)


x = c("type1", "type2", "type3")
y1 = c("1","2","3")
y2 = c("2","3","4")

to_plot <- data.frame(x=x,y1=y1,y2=y2)
melted<-melt(to_plot, id="x")

ggplot() + geom_bar(data=melted,aes(x=x,y=value,fill=variable),stat="identity",position = "identity", alpha=.3)

This gave me the following output: enter image description here

Is there anyway I can change the color of the bar graphs? For example, I would like the y1 graph to be the same grey as the background

cosmictypist
  • 555
  • 1
  • 7
  • 17

1 Answers1

1
ggplot() + geom_bar(data=melted,aes(x=x,y=value,fill=variable),
                    stat="identity",position = "identity", alpha=.3) +
  scale_fill_manual(values=c("#955599", "#E63F00"))

You can now play with the palette (-;

Bram
  • 342
  • 1
  • 12