[R] need tick marks by 10s or 20s up to 200 on x axis

Joshua Wiley jwiley.psych at gmail.com
Thu Feb 17 22:30:39 CET 2011


Hi Julie,

Here is a little example.  First I make a histogram (it looks odd
because there isn't much data), then add the x axis in manually
specifying at what points to place tick marks.

## histogram suppressing x axis
hist(c(0, 200), xaxt = "n")
## add axis with custom ticks
axis(1, at = seq(0, 200, 20))

## For documentation see
?par
?axis

## the documentation for par is long and is never fun to go through,
but it really explains a lot and R graphics will seem less mysterious
if you schedule an hour to sit down and read through it

Cheers,

Josh


On Thu, Feb 17, 2011 at 12:58 PM, Julie McWhorter
<juliemcwhorter at hotmail.com> wrote:
>
> I haven't been able to get any code to make more tick marks than the default by 50.
> Thanks!  Code:
> hist(OMY$FL, main = "2010 Oncorhynchus mykiss Fork Length Frequencies at Buck Creek Reach 1", include.lowest = TRUE, col = "blue", border = "white", breaks = 140,xlab = "Fork Length  in  mm", ylab = "Frequency", xlim = range(0,200), ylim = range (0,15), xbar=10)
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list