[R] Immutable ticks using ts.plot?

From: Phil Morefield <philmorefield_at_yahoo.com>
Date: Tue, 26 Apr 2011 06:19:20 -0700 (PDT)

Hello all-

What I'm going for here is a stack of four time series plots that use a common X axis on the bottom plot. And setting up customized tick marks on each plot that help illustrate the respective trends. Here's my code:

#### Start ####
fig_data <- ts(read.csv("F:/mydata.csv"), start=2000, end=2010, freq=1) opar = par()
plot(fig_data, ann = FALSE, plot.type = "multiple", yaxt='n',xaxt = "n", panel=function(...){
  for (i in 1:4){
    if (i == 1){
      ts.plot(fig_data[,i],lwd=3,col="red", gpars=list(yaxp=c(80,90,2),xaxt = 'n', ann=FALSE))
      abline(v=2007, lty = "dashed", col = "grey")
    if (i == 2){
      ts.plot(fig_data[,i],lwd=3,col="green", gpars=list(yaxp=c(65,75,2),xaxt = 'n', ann=FALSE))
      abline(v=2007, lty = "dashed", col = "grey")
    if (i == 3){
      ts.plot(fig_data[,i], lwd=3,col="blue",gpars=list(yaxp=c(32,36,2),xaxt = 'n', ann=FALSE))
      abline(v=2007, lty = "dashed", col = "grey")
    if (i == 4){
      ts.plot(fig_data[,i],lwd=3,col="brown", gpars=list(yaxp=c(155,170,2), yaxt='n', ann=FALSE))
      abline(v=2007, lty = "dashed", col = "grey")

#### End ####

My problem is that for the bottom plot ( when i == 4) I have no control over the default ticks. yaxt = 'n' has no effect, nor does xaxt = 'n'. However I can add ticks with with yaxp or xaxp; I just can't remove the existing ticks. Is this known/correct behavior? Am I overlooking some way to remove those default ticks?



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. Received on Tue 26 Apr 2011 - 13:25:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Apr 2011 - 14:00:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive