I have a normal distribution plot and a histogram plot with x axis in log scale displaying 0, 10^0, 10^1 ... I want to include minor ticks between the major ones. Actually I was
There is the minorAxis
function in the StratigrapheR
package, that can be used for any kind of minor ticks. It can be used with the seq_log
function to make logarithmic ticks:
library(StratigrapheR)
x <- exp(rnorm(200, 5))
hist(log10(x), 20, xaxt="n", xlim=c(0, 4), xlab = "x", main = "Logarithmic Histogram of x")
ticks <- seq_log(10^0,10^4, divide = T)
lab <- sapply(0:4, function(i) as.expression(bquote(10^ .(i))))
minorAxis(1, at.maj = log10(ticks[[1]]), at.min = log10(ticks[[2]]), labels = lab)
Gives: