更改多色时的模型颜色(ggplot2)

时间:2015-10-20 01:09:19

标签: r colors ggplot2 coefplot

我在multiplot包中使用coefplot函数,该函数使用ggplot2作为基础。我正在绘制多个模型,但无法弄清楚如何更改每个模型的颜色。例如:

require(coefplot)
data(diamonds)
model1 <- lm(price ~ carat + cut, data=diamonds)
model2 <- lm(price ~ carat + cut + color, data=diamonds)
multiplot(model1, model2)
# multiplot(model1, model2, colors = c("blue", "red"))  # Doesn't Work

对此有何想法?

1 个答案:

答案 0 :(得分:2)

您可以尝试添加scale_color

multiplot(model1, model2)+scale_color_manual(values=c("red","blue"))

如果是ggplot基本函数,那么尝试使用ggplot settigns