I need to create a plot from a data frame that contains data from multiple files. Some of the files are labelled as reference
and some as user
. I want to have smooth lines for each file, but the coloring should be done by label. Here is some test data for testing:
test <- data.frame(
y = c(1, 2, 2, 3, 3, 4, 4, 5),
x = rep(c(1, 2), 4),
label = c("ref", "ref", "ref", "ref", "user", "user", "user", "user"),
file = as.character(c(1, 1, 2, 2, 3, 3, 4, 4))
)
My current make-shift solution is to use shape=file
:
ggplot(test, aes(x=x, y=y, color=label, shape=file)) +
geom_point(size=3) +
geom_line() +
guides(shape=FALSE)
But I wonder whether there is a solution that does not rely on the shape, because I ideally want them to be the same. I already looked at the following questions, but they were all not helpful for my case: