In the following graph, how can I include the line of, for example group "B" in every facet, in black?
x <- c(seq(1, 10, 1), seq(1, 10, 1), seq(1, 10, 1))
c <- c(rep("A", 10), rep("B", 10), rep("C", 10))
y <- rnorm(30, 0, 1)
d <- data.frame(x = x, c = c, y = y)
d$c <- as.factor(d$c)
library(ggplot2)
ggplot() +
geom_line(data = d, aes(x = x, y = y, color = c)) +
facet_wrap(~c)
The following code, although suggested by this solution, only creates the line in category B in black but does not include it in all facets:
ggplot() +
geom_line(data = d, aes(x = x, y = y, color = c)) +
facet_wrap(~c)+
geom_line(data=d[d$c=="B",], aes(x=x,y=y))
Thanks in advance.