[R] Is there a way to change x and y axis tick mark inside plot()?

Marc Schwartz marc_schwartz at me.com
Fri Sep 20 19:42:50 CEST 2013


On Sep 20, 2013, at 11:17 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:

> On 20/09/2013 11:52 AM, C W wrote:
>> Dear R community,
>> I am having trouble changing the tick marks on y-axis to every 5 units?  I
>> have the following:
>> 
>> x <- c(12, 16, 6, 23, 27, 8, 5, 19, 23, 13, 16, 8)
>> 
>> y <- c(29, 29, 23, 34, 38, 24, 22, 34, 36, 27, 33, 27)
>> 
>> plot(x, y, pch=19)
>> 
>> Should I change ylim=c(0,40), and then use axis()?
> 
> Don't use ylim, use yaxt="n", then use axis().
>> 
>> I kept on thinking I can do everything inside plot(), but there is actually
>> axis(), par(), ..., and so on.
>> Could someone tell me why is there so many functions outside plot().  I'm
>> sure there is a reason, but I don't seem to understand why.
> 


> R is designed to be flexible.  If you create giant functions that can do everything, you end up with a design like SAS, which is extremely inflexible.  It's good at what it can do, but it's very hard to get it to do something the designers didn't think of.
> 
> Duncan Murdoch


Fortune candidate, with cc: to Z.

Regards,

Marc Schwartz



More information about the R-help mailing list