[R] plot()

Yuelin Li yuelin at mail.med.upenn.edu
Tue Jan 7 05:37:04 CET 2003


try text(c("1970", "1978", "1990"), x=1:3, y=1:3) after you first 
call plot(c(1, 3), c(1, 3), axes=F, type="n", xlab="", ylab="") 
to set the plotting area.

Yuelin.


--  From: Nirmala Ravishankar <n_ravishankar at yahoo.com>
  To: r-help at stat.math.ethz.ch
  Subject: [R] plot()
  Date: Mon, 6 Jan 2003 20:19:58 -0800 (PST)
  
  I am an R novice trying to figure out plot(). 
  Specifically, I am trying to plot the values of a
  numeric variable V for a set of years (1970, 1974,
  1976, 1978, 1980).  How do I get R to label the years
  I am plotting on the x-axis rather then some general
  levels (1970, 1975, 1980.)  Using as.character(year)
  doesn't seem to help, and using as.factor(year)
  generates steps insteads of dots.
  
  Help will be most appreciated.  I have listed the code
  I have been using below:
  
  > plot(y$year, y$V, type = "b")
  > plot(as.character(y$year), y$V, type = "b")
  > plot(as.character(y$year), y$V, type = "b")
  
  
  Thanks,
  NR
  
  ______________________________________________
  R-help at stat.math.ethz.ch mailing list
  http://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list