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 able to change the major ticks format from 1, 2, 3 and so on to 10^0, 10^1, 10^2, 10^3 using the solution given to me in my previous question. I used the following code for the major ticks :
major.ticks <- axTicks(1)
labels <- sapply(major.ticks,function(i)
as.expression(bquote(10^ .(i)))
)
axis(1,at=major.ticks,labels=labels)
Can this be edited to just mark the minor ticks without labeling them?
There is a function
minor.tickin the packageHmisc, but that one deals poorly with logarithmical scales. I use the following function for getting minor ticks that follow the logarithmical scale.axis the axis you use it on (same as for the functionaxis),nis the number of minor ticks (default to 9),t.ratiois the ratio between the major and the minor ticks, and with...you can pass extra parameters toaxisedit : Nice idea in the comments, so I edited my function. There are two extra parameters,
mnandmxfor the minimum and the maximum on the logarithmic scale (mn=0thus means the minimum is 10^0 or 1 !)The function:
This can be applied as follows :
Gives :