I have a vector of integers, e.g.: 2,8,11,19
.
I would like to plot a line of length e.g. 20 then plot a dot for each value that exist in the list (at some constant height), so I get something like this:
-+-----+--+-------+-
I have a vector of integers, e.g.: 2,8,11,19
.
I would like to plot a line of length e.g. 20 then plot a dot for each value that exist in the list (at some constant height), so I get something like this:
-+-----+--+-------+-
library(lattice)
x <- c(2, 8, 11, 19)
stripplot(x)
you can adjust the scales to your liking. see ?stripplot
With the base graphics:
x <- c(2,8,11,19)
x <- data.frame(x,1) ## 1 is your "height"
plot(x, type="b")
Brandon Bertelsen is really close...
x <- c(2,8,11,19)
x <- data.frame(x,1) ## 1 is your "height"
plot(x, type = 'o', pch = '|', ylab = '')
But I wrote this mostly to mention that you might also in base graphics look at stripchart() and rug() for ways to look at 1-d data.