[R] Ticks on barplots
Michael H. Prager
Mike.Prager at noaa.gov
Tue Mar 20 23:04:07 CET 2007
Using R 2.4.1 on Windows XP
I am generating stacked barplots of age-composition of fish populations
(Y) over time (X). As there are many years, not every bars is labeled.
When looking at the plot, it becomes difficult to associate labels with
We have improved this a bit by using axis() to add a tickmark below each
bar. Can anyone suggest a way to draw ticks ONLY at bars where a tick
label is drawn? Or to make such ticks longer than those where there is
This is going into a function, so I'm hoping for a method that doesn't
require looking at the plot first.
I have attached a PDF.
# sample code (simplified) #
mp <- barplot(t(N.age), xlab = "Year", axisnames = FALSE)
axis(side = 1, at = mp, labels = rownames(N.age), tcl = -0.75)
NOAA, Beaufort, NC
More information about the R-help