I realize there have been several posts for people asking how to plot two histograms together side by side (as in one plot with the bars next to each other) and overlaid in R and also on how to normalize data. Following the advice that I've found, I'm able to do one or the other, but not both operations.
Here's the setup. I have two data frames of different lengths and would like to plot the volume of the objects in each df as a histogram. Eg how many in data frame 1 are between .1-.2 um^3 and compare it with how many in data frame 2 are between .1 and .2 um^3 and so on. Overlaid or Side by Side would be great to do this.
Since there are more measurements in one data frame than the other, obviously I have to normalize, so I use:
read.csv(ctl)
read.csv(exp)
h1=hist(ctl$Volume....)
h2=hist(exp$Volume....
#to normalize#
h1$density=h1$counts/sum(h1$counts)*100
plot(h1,freq=FALSE....)
h2$density=h2$counts/sum(h2$counts)*100
plot(h2,freq=FALSE....)
Now I've been successful overlaying the un-normalized data using this method: http://www.r-bloggers.com/overlapping-histogram-in-r/ and also with this method: plotting two histograms together
but I'm stuck when it comes to how to overlay normalized data