[R] Question about setting tick mark limits in Plot

Spencer Graves spencer.graves at pdf.com
Wed Dec 29 22:54:23 CET 2004

How about the following: 

p <- seq(0, 240, len=2198)
q. <- rep(1, len=2198)

plot(p,q., pch="|", yaxt="n", xaxt="n",
     xlab="Minutes", ylab="")
axis(1, seq(0, 240, 30))

      Note:  "q" is a system function, so I changed it to "q.". 

      hope this helps.  spencer graves

Justin Rhodes wrote:

>Dear R-list,
>I am having trouble getting the Plot function to set the tick marks the
>way I want, and I am not sure what I am doing wrong.  
>Below is the code that I wrote, and I am not sure why it doesn't work. 
>p is a vector of length 2198, containing numbers between 0 and 240.  q
>is a vector of ones, the same length as p.  I want the x-axis to have
>tick marks every 30 min and I want the last tick mark to be at 240 min. 
>When I run the program it only plots 5 tick marks starting at 0 and
>ending at 200,  though the data extend to 240 min.  I am very confused. 
>Thanks for any help.  I really appreciate it.  I have wasted too much
>time trying to figure this out on my own.
>plot(p,q, pch="|", yaxt="n", main=subject,xlab="Minutes", ylab="")
>Take care,
>Justin Rhodes
>Behavioral Neuroscience
>Oregon Health & Science University
>VA Medical Center (R & D 12)
>3710 SW US Veterans Hospital Rd
>Portland, OR  97239
>Phone: (503) 220-8262 extn 54392
>Fax: (503) 721-1029
>E-mail: rhodesju at ohsu.edu
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567

More information about the R-help mailing list