I'm trying to plot a basic correlation between two 7-point variables. I get a .72 correlation, but the data points are just one dot at every number point on the graph (like just dots equally spaced out into rows). I double checked to make sure the variables are numeric (they are). I tried several different ways to graph it, the dots always come out the same way. Any ideas?
Code:
library("ggpubr")
ggscatter(plotdata, x = "TID", y = "PID7", use = "complete.obs",
add = "reg.line", conf.int = TRUE,
cor.coef = TRUE, cor.method = "pearson",
xlab = "X", ylab = "Y")
Sample data:
dput(head(plotdata, 20))
structure(list(plotdata.TID = c(7, 1, 3, 5, 5, 7, 7, 6, 1, 4,
1, 4, 1, 1, 7, 7, 1, 1, 1, 4), plotdata.PID7 = c(1, 1, 3, 6,
6, 7, 6, 6, 2, 7, 1, 4, 1, 1, 7, 6, 2, 3, 2, 4)), row.names = c(NA,
20L), class = "data.frame")