2

stripchart :

x <- c(2, 8, 11, 19)
stripchart(x)

How do you add labels 2, 8, 11, 19 next to the points?

Community
  • 1
  • 1
weis26
  • 401
  • 6
  • 16

1 Answers1

3

Use text and specify the y position. The stripchart is drawn with y=1, so text(x, y=1.1, ...) will draw the labels slightly above the points.

x <- c(2, 8, 11, 19)
stripchart(x)
text(x, 1.1, labels=x)

enter image description here

Andrie
  • 176,377
  • 47
  • 447
  • 496
  • 2
    That only works as long as the values are clearly separated. As soon as you jitter / stack the values this breaks down, and is not trivial to fix. – Konrad Rudolph Dec 08 '13 at 12:49