I've created a 2x2 data frame for plotting a single line comparing 2 the outcome of 2 treatment. The code I used for this actually does yield a plot with the line but the x limits does not allow to see the x labels, which contains a factor variable with only 2 categories.
I tried changing the names of the levels in the factor, changing the xlim in the ggplot() function, putting different values (even characters), checking my luck using geom_abline(), but nothing has worked.
library(ggplot2)
quien <- factor(c(1,2))
names(quien) <- c("Solo", "Con amigos")
likes<-c(4.3,3.8)
selfie <- data.frame(quien, likes)
ggplot(data=selfie, aes(x=quien, y=y))+
geom_line()+
ylim(0,5)
The expected outcome is a plot with a line that joins the coordinates ("Solo, 4.3) and ("Con amigos", 3.8), as we see it in a comparison for two groups of an Experiment with one single factor and 2 treatments.
The code I showed before yields the next error message:
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?