I’m trying to make a simple line plot but I get the following error:
geom_path: Each group consist of only one observation. Do you need to
adjust the group aesthetic?
I want status.std on the y-axis, effort on the x-axis, with status_measure distinguishing the two separate lines.
Below is my data and the code I’m executing:
df.effort <- structure(list(effort = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 3L,
4L), .Label = c("never", "not very hard", "hard enough", "very hard"
), class = "factor"), status.std = structure(c(-0.0234448237301297,
0.0568346993679614, 0.0780165665285588, -0.0380394621882508,
-0.135535917573711, 0.0128879641418037, 0.0806307867881565, -0.0104818763687783
), .Names = c("never", "not very hard", "hard enough", "very hard",
"never", "not very hard", "hard enough", "very hard")), status_measure = structure(c(1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L), .Label = c("avrank.zmgs", "acent09l.zmgs"
), class = "factor")), .Names = c("effort", "status.std", "status_measure"
), row.names = c(NA, 8L), class = "data.frame")
ggplot(data=df.effort,
aes(x=effort), y=status.std, colour=status_measure)) + geom_line()
Many thanks for any help. I regret that this question seems unlikely to be instructive to others. If there is a title edit or something that would make it more general that would be fantastic.
Syntax error. Need to move the paren so that aes(…) gets both the x and y arguments (but not the colour argument, because simply moving to the end generates the error you posted.)
Which succeeds but fails to color anything. And how could a color be picked for the lines anyway? I think the colors would adhere to the points, so try this:
Or maybe you do want what joran posted:
(I thought you were trying to use geom_line to link measurements within category of effort with color distinguishing between status measures.)