[R] densityplot and histogram

Jean Eid jeaneid at chass.utoronto.ca
Wed Oct 20 00:12:07 CEST 2004

Is there any function like par(new=T) for lattice. I want to plot a
histogram in percentages on the right hand side and also superimpose the
densityplot with its density scale on the lhs. so far I am only able to do
  histogram( temp[,2]~ temp[,1],nint=100,type="desnity",
               xlab = "Population Size",
               panel = function(x, ...) {
                   panel.histogram(x, ...)
                   panel.densityplot(x, col = "red", plot.points=F, lwd=2)
               } )

 If I change type="density" to type="percent" the scales for the
densityplot will be too low and all I see is a horizontal line at zero
(this is as expected) . However, I tried par(new=T) and nothing happens. I
want to be able to put percenstages on axis 2 and density values at axis

Thank you


More information about the R-help mailing list