Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change outline and fill colors of histogram with qplot

I have two histograms in one window (using facet) and I would like control over the color of the outline and the fill. I've tried looking up color scales, aes(), + color, + fill, including color and fill in qplot, all resulting in expected plots!

My code can be found below. (Note: mussel2 has two columns concentration (a list of numbers) and waterbody (listed or reference). I can provide the data if necessary.

I understand this is an elementary question, so I do appreciate your time.

qplot(data=mussel2,
    x = Concentration,
    xlim = x_lim, 
    ylim = y_lim, 
    xlab = expression(paste("Concentrations of DDE (", mu, "g/g)")), 
    ylab = "Frequency",
    binwidth = 1.5)+ 
    theme(legend.position="none")+
    facet_grid(Waterbody~.)
like image 787
user2793148 Avatar asked Sep 18 '13 20:09

user2793148


1 Answers

If you want to keep the qplot format, try the following:

library(ggplot2)

qplot(diamonds$carat, 
      xlab="Carat", 
      geom="histogram", 
      ylab="Count", 
      binwidth=0.25, 
      fill=I("grey"), 
      col=I("black"))

enter image description here

like image 88
Andre Silva Avatar answered Sep 23 '22 19:09

Andre Silva