[R] double-axis labels function of each other

Hurr hill0093 at umn.edu
Fri Apr 3 06:44:03 CEST 2015


Thanks, That was good help; I tried this; I hope I didn't copy it wrong:

#try 2 axes at bottom
x1 <- c(1,2,3,4,5,6,7,8,9)
x2 <- c(5,1,9,6,3,7,8,2,4)
par(mar=c(7,4,4,2))
plot(x1,x2,type="l",xlab=””) #scatter plot x1 on horiz, x2 on vert axis
require(plotrix)
fullaxis(1,at=pretty(x1),labels=round(1/pretty(x1),3),tick=TRUE,
 col=”red”,col.axis=”red”,lwd=4,pos=-0.2)
mtext(“x1”,side=1,line=4.5)

This is the response I got. 

> #try 2 axes at bottom
> x1 <- c(1,2,3,4,5,6,7,8,9)
> x2 <- c(5,1,9,6,3,7,8,2,4)
> par(mar=c(7,4,4,2))
> plot(x1,x2,type="l",xlab=””) #scatter plot x1 on horiz, x2 on vert axis
Error: unexpected input in "plot(x1,x2,type="l",xlab=”"
> require(plotrix)
> fullaxis(1,at=pretty(x1),labels=round(1/pretty(x1),3),tick=TRUE,
+  col=”red”,col.axis=”red”,lwd=4,pos=-0.2)
Error: unexpected input in:
"fullaxis(1,at=pretty(x1),labels=round(1/pretty(x1),3),tick=TRUE,
 col=”"
> mtext(“x1”,side=1,line=4.5)
Error: unexpected input in "mtext(“"
>

This works but the X-axis name is not in right place:

#try 2 axes at bottom
x1 <- c(1,2,3,4,5,6,7,8,9)
x2 <- c(5,1,9,6,3,7,8,2,4)
par(mar=c(7,4,4,2))
plot(x1,x2,type="l") #scatter plot x1 on horiz, x2 on vert axis
require(plotrix)
fullaxis(1,at=pretty(x1),labels=round(1/pretty(x1),2),tick=TRUE,
 lwd=4,pos=-0.2)




--
View this message in context: http://r.789695.n4.nabble.com/double-axis-labels-function-of-each-other-tp4705457p4705460.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list