2
我已创建使用geom_smooth一个简单的图形:GGPLOT2:geom_smooth颜色与scale_colour_brewer
test.dat <- data.frame(matrix(c(runif(20, 0, 20)), 10, 2))
names(test.dat) <- c("x", "y")
test.plot <- ggplot(test.dat, aes(x,y)) + geom_point() +
geom_smooth(method="loess")
所产生是通过默认蓝色的线。我可以通过添加此手动将其更改为给定的颜色:
test.plot + geom_smooth(method="loess", colour="black")
不过,我想基础上,我已经使用了一系列情节的调色板上的颜色选择。 (不使用scale_fill_brewer代替也不)
scale_colour_brewer(type = "div", palette = "Spectral")
然而,这并没有任何效果:通常,这将是通过将各行来实现的。我发现了一些颜色为here的geom_smooth行为的一些讨论,但对于这个特定问题没有明显的解决方法。有什么建议么?
谢谢,那真是太棒了。如果没有看到这种'颜色=真'的方式在之前把东西放进去;现在我明白了我是如何陷入困境的。再次感谢! – simoncolumbus 2014-11-05 13:55:41
@simoncolumbus,如果这回答你的问题,请考虑检查它的答案。 – BrodieG 2014-11-05 15:04:08