16

I am having the following issue with the axis() function.

 axis(1,
       at=1:length(stringi::stri_rand_strings(21, 15)),
       labels=stringi::stri_rand_strings(21, 15),
       tick=1,
       lwd=1,
       mgp = c(0,1,0),
       col = title_colour,
       col.ticks = title_colour
       ,lty = "solid",
       cex.axis = 1,las=2,cex=0.75)

enter image description here

But whatI really need are the tickmarks without the continuous x'x line connecting the ticks:

enter image description here

How do I accomplish this using axis()??

2
  • 5
    use lwd and lwd.ticks: axis(1, lwd = 0, lwd.ticks = 1)
    – rawr
    Mar 21, 2017 at 16:36
  • That's the one I used. Please add it as an answer.
    – J. Doe.
    Mar 21, 2017 at 16:48

1 Answer 1

17

Set col to NA but col.ticks to a value:

plot(1, type = 'n', axes = FALSE)
axis(1, c(0.75, 1, 1.25), col = NA, col.ticks = 1)

enter image description here

(Note my reproducible and minimal example, try to include that in your question!)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.