Using the data in this question https://stackoverflow.com/questions/21663108/coloring-points-on-a-lattice-plot-in-r I want to use the function histogramin latticeto build three histograms on the same section, but separately so that I can control the colors and allow a translucent color where the histograms overlap.
However, the following code does not work:
histogram(locs[locs.col=="darkblue"] , breaks=20, xlim=c(25,150),col="darkblue" )
histogram(locs[locs.col=="yellow"] , breeaks=20, xlim=c(25,150),col="yellow",add=T ) # add doesn't work here
histogram(locsy[locs.col=="red"] , breaks=20, xlim=c(25,150),col="red",add=T )
because histograms will not be added to eachother. I know that this works for a function histin basic packages, so here are my questions:
1) Is there a way to add histograms to the chart with histogram? 2) How can I make the histogram bins of the same width for each histogram instance 3) How can I make the colors translucent for where the histograms overlap? 4) How to rotate the histogram 90 degrees so that it is a horizontal axis?
source
share