i have survey each line represents person , each column represents how long took complete survey
i plot dot per timing per person if example person completed first part x1
in 10 minutes , second part x2
in 12 minutes, third part in 15 minutes x3
, fourth part in 45 minutes x4
id 1 have these 4 dots on y axis id x axis point
id <- sample(1:12) x1 <- sample(1:250, 12, replace=f) x2 <- sample(1:250, 12, replace=f) x3 <- sample(1:250, 12, replace=f) x4 <- sample(1:250, 12, replace=f) mydf <- data.frame(id,x1,x2,x3,x4)
i tried using ggplot specified x axis id im not sure how represent other columns different counts
does know if possible
any great
i believe need melt
data.frame
first , construct desired plot.
library(reshape2) melted <- melt(mydf, id.vars = "id") # melt data # generate plot library(ggplot2) ggplot(melted, aes(factor(id), value, colour = variable)) + geom_point()
Comments
Post a Comment