我没有那么多使用ggplot2,但是今天我想我会在一些图表上试一试.但我无法弄清楚如何手动控制颜色geom_line()
我确定我忽略了一些简单的东西,但这是我的测试代码:
x <- c(1:20, 1:20)
variable <- c(rep("y1", 20), rep("y2", 20) )
value <- c(rnorm(20), rnorm(20,.5) )
df <- data.frame(x, variable, value )
d <- ggplot(df, aes(x=x, y=value, group=variable, colour=variable ) ) +
geom_line(size=2)
d
Run Code Online (Sandbox Code Playgroud)
这给了我预期的输出:

我认为我所要做的就是这样简单:
d + scale_fill_manual(values=c("#CC6666", "#9999CC"))
Run Code Online (Sandbox Code Playgroud)
但这没有任何改变.我错过了什么?