Search code examples
rplot

Put tick labels of only x-axis inside plotting area


Is it possible to put tick labels of only x-axis inside plotting area? I am trying:

axis(1,at=c(0:71),c(rep(0:23,3)),cex.axis=.7, font=1,tck=.01)

It seems that:

par(mgp=c(0,-1.4, 0)) 

puts both x and y tick labels inside plotting area.


Solution

  • Why don't you just draw the ticks where you want them using the pos argument to axis():

    plot(0:72, xaxt="n")
    text(0:71, -1, rep(0:23, 3), cex = 0.5)
    axis(1, at=c(0:71), NA, cex.axis=.7, font=1, tck=.01)
    

    enter image description here