Search code examples
rloggingscale

Y axis not long enough (Log scale)


Hi, I'm trying to get a visually pleasing Y axis

counts=c(Low = 3553, Mid = 203, High = 3158, Low = 13, Mid = NA, High = NA,Low = 16, Mid = 14, High = NA,Low = 1, Mid = 7, High = 21)
barplot(counts,log="y",ylab="Total counts from quadrats (Log scale)",axes=F)
axis(2, 0:4000)

enter image description here As you can tell from the results, things get a bit messy. And if I do axes=T, the axis just stops at 1000.


Solution

  • You can specify where you want the tick marks in axis. Also, change the ylim in barplot appropriately.

       counts=c(Low = 3553, Mid = 203, High = 3158, Low = 13, Mid = NA, 
            High = NA,Low = 16, Mid = 14, High = NA,Low = 1, Mid = 7, High = 21)
    
        barplot(counts,log="y",
                ylab="Total counts from quadrats (Log scale)",
                axes=F,
                ylim = c(1, 4096))
    
        axis(2, c(1, 8, 124, 4096))
    

    enter image description here