Andrew Yee
2008-Jun-16 18:52 UTC
[R] in axis() suppressing axis line but keeping tick marks
I've been trying to figure out a parameter that will let you separately adjust the parameters for the axis line from the tick mark. In the following example, I would like to suppress the axis line, but keep the tick marks. Thanks, Andrew foo <- data.frame(x=1:3, y=4:6) plot(foo$x, foo$y, type="n", axes=F) points(foo$x, foo$y) axis(side=1, at=foo$x, lty=0) #would like to figure out way to keep tick marks, but suppress axis line [[alternative HTML version deleted]]
Peter Dalgaard
2008-Jun-16 20:49 UTC
[R] in axis() suppressing axis line but keeping tick marks
Andrew Yee wrote:> I've been trying to figure out a parameter that will let you separately > adjust the parameters for the axis line from the tick mark. > > In the following example, I would like to suppress the axis line, but keep > the tick marks. >The source code is the ultimate reference. We have in do_axis in src/main/plot.c: if (doticks) { gpptr(dd)->col = col;/*was fg */ GLine(axis_low, axis_base, axis_high, axis_base, NFC, dd); for (i = 0; i < n; i++) { x = REAL(at)[i]; if (low <= x && x <= high) { x = GConvertX(x, USER, NFC, dd); GLine(x, axis_base, x, axis_tick, NFC, dd); } } } and, as you see, there is no way the line parameters can change between the GLine calls, no hope of finding a magical par() setting. So I'm afraid you have to bite the bullet, do the relevant coordinate calculations, and use segments() do draw the ticks. (Or try convincing Paul Murrell to change the design, but that takes longer...). -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Gabor Grothendieck
2008-Jun-17 01:12 UTC
[R] in axis() suppressing axis line but keeping tick marks
You could try overwriting the axis with a white axis line so it blends into the background. plot(1:10, axes = FALSE) axis(1) axis(1, col = "white", tcl = 0) On Mon, Jun 16, 2008 at 2:52 PM, Andrew Yee <yee at post.harvard.edu> wrote:> I've been trying to figure out a parameter that will let you separately > adjust the parameters for the axis line from the tick mark. > > In the following example, I would like to suppress the axis line, but keep > the tick marks. > > Thanks, > Andrew > > > foo <- data.frame(x=1:3, y=4:6) > plot(foo$x, foo$y, type="n", axes=F) > points(foo$x, foo$y) > axis(side=1, at=foo$x, lty=0) #would like to figure out way to keep tick > marks, but suppress axis line > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >