Try defining the argument 'pos' in the axis command-line, like: x <- rnorm(100) z <- gl(2,50) y <- rnorm(100, mean= 1.8*as.numeric(z))
plot(x,y,type="n", axes=F) points(x,y, pch="$",cex=0.7, col=z) axis(1, col="green", col.axis="green", pos=0) axis(2, col="red", col.axis="red", pos=-2) ________________________________________ Daniel Moreira, MD Research Associate Duke University Medical Center DUMC 2626, MSRB-I Room 455 571 Research Drive Durham, North Carolina 27710 Telephone: (919) 681-7132 Fax: (919) 668-7093 E-mail: daniel.more...@duke.edu Paul Johnson <pauljoh...@gmail.com> Sent by: r-help-boun...@r-project.org 02/13/2009 02:25 PM To R-help <r-h...@stat.math.ethz.ch> cc Subject [R] I want axes that cross Hello, everybody. A student asked me a howto question I can't answer. We want the length of the drawn axes to fill the full width and height of the plot, like so: | | * | * | * ---|----------------- However, when we use plot with axes=F and then use the axis commands to add the axes, they do not cross over each other. We get | * | * * ---------- The axes are not wide enough to cover the entire range of the data. We do not want to add a box() command, which is a usual answer for this, because we don't want to draw on top or the side. Here's my test case: x <- rnorm(100) z <- gl(2,50) y <- rnorm(100, mean= 1.8*as.numeric(z)) plot(x,y,type="n", axes=F) points(x,y, pch="$",cex=0.7, col=z) axis(1, col="green", col.axis="green") axis(2, col="red", col.axis="red") Can I cause the 2 axes to "cross" as desired? The axis help says the axis is clipped at the plot region, but it seems to get clipped even more narrowly thanthat. I've been searching in r-help quite a bit and am a little surprised how difficult this is.... -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas ______________________________________________ R-help@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. [[alternative HTML version deleted]] ______________________________________________ R-help@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.