I put together a function that behaves the same with history in the default case, but accepts a log argument. He uses several tricks from other posters, but adds some of his own. hist(x) and myhist(x) look the same.
The original problem will be solved with:
myhist(mydata$V3, breaks=c(0,1,2,3,4,5,25), log="xy")
Function:
myhist <- function(x, ..., breaks="Sturges", main = paste("Histogram of", xname), xlab = xname, ylab = "Frequency") { xname = paste(deparse(substitute(x), 500), collapse="\n") h = hist(x, breaks=breaks, plot=FALSE) plot(h$breaks, c(NA,h$counts), type='S', main=main, xlab=xlab, ylab=ylab, axes=FALSE, ...) axis(1) axis(2) lines(h$breaks, c(h$counts,NA), type='s') lines(h$breaks, c(NA,h$counts), type='h') lines(h$breaks, c(h$counts,NA), type='h') lines(h$breaks, rep(0,length(h$breaks)), type='S') invisible(h) }
Exercise for the reader: unfortunately, not everything that works with history works with my mythologist. This should be fixed with less effort.