[R] Axes=F and plotting dual y axes

Johnson, Cedrick W. cedrick at cedrickjohnson.com
Wed Jul 28 18:16:23 CEST 2010


Howdy. Been running into a bit of trouble with plotting. Seems that 
axes=F is not "working". Whenever I plot (either a dataframe or xts/zoo 
series) and I set axes=F along with xlab/ylab="" I still get the default 
axes printed in my chart. Consider this:


#Create some sample data, both 50 units of blah
series2 = c(1:50)
series1 = rep(25:74)

testdf1 = as.data.frame(series1)
testdf1$series2 = series2

As a note, I converted my original xts/zoo dataset into a dataframe 
thinking it could be weirdness on the part of that. I just did this here 
to have something reproducible since it's not feasible to put my entire 
original dataset in the email.

plot(testdf1[,1], main="Woo", col=rich12equal, xlab="", ylab="", axes=F, 
type='l')

It still displays the x and y axes. What I'm trying to do:

par(new=T)

plot(testdf1[,2], ...)

and from there I can manually label the axes, title, etc.

Any idea what's going on? I'm using R 2.10.1 on ubuntu (I probably need 
to upgrade via debian packages soon)


Regards,
CJ

ps: I am trying to accomplish this, as seen here: 
http://blog.earlh.com/index.php/2009/07/multiple-y-axes-in-r-plots-part-9-in-a-series/
  -- but axes=F is giving me trouble.



More information about the R-help mailing list