r - Use axis() to draw axis without ticks -


given plot without axes, use axis add horizontal axis. on left hand side see given "baseline" plot, on right hand side desired result: baseline , expected plot

the baseline plot generated using

plot(1, axes = false, main = "baseline") 

question: how generated desired output? (condition: using axis after plot has been generated.)

i expected want when specifying tick = false, labels = false, doesn't work. below tests, self-explanatory:

par(mfrow = c(2,2))  plot(1, axes = false, main = "full axis") axis(1) # axis, ticks , labels  plot(1, axes = false, main = "no labels") axis(1, labels = false) # axis, ticks  plot(1, axes = false, main = "no ticks (and no axis)") axis(1, tick = false) # no axis (unexpected), labels  plot(1, axes = false, main = "nothing (instead of axis)") axis(1, tick = false, labels = false) # nothing - expected: axis without ticks, without labels 

tests

i expected last plot deliver desired output, axis not drawn @ all. apparently, ticks = false suppresses axis well.

remark: "expected" plot generated using

plot(1, axes = false, main = "expected") axis(1, @ = c(-100, 100)) 

but looking "cleaner" solution placing unwanted ticks outside visible area.

other workarounds axis(1, lwd.tick=0, labels=false), axis(1, tcl=0, labels=false), draw 0 width or 0 length ticks, respectively. @lyzander's solution seems draw white ticks on top of axis. proposed box() solutions , ?par don't seem draw x axis?


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -