I try to generate a histogram with 2 Y-axes. 1 Y-axe with the freq and 1 Y-axe with the cumulative freq in %. this is the closest I can get but it's a bit messy at the plot multiple labels on the axes, axis 4 not properly formatted
x<-rnorm(100,5,2)
hist(x,col=c("51"))
par(new=T)
plot(ecdf(x))
axis(4, at=1:10, col.ticks="red")
mean <- paste("mean = ", round(mean(x), digits = 4))
sd <- paste("sd = ", round(sd(x),digits = 4))
median <- paste("median = ", round(median(x),digits = 4))
legend(x = "topleft", c(mean,sd,median), bty = "n")
Thank in advance for your help,