我需要显示一个带有visreg的模型,同时自定义顶部层的 colored颜色 . 我以空气质量数据集为例.这是我创建Visreg层的代码,我想在其中可视化不同级别的风的模型.绘制时,根据第三个数值变量的点的 colored颜色 将减少到2.
visreg(fit,"Solar.R","Wind",
overlay=TRUE,breaks = 2,gg=TRUE)+
scale_color_manual(values = c("#90da90", "red3"))+
scale_fill_manual(values = c("gray", "gray"))+
theme_minimal()
即使我想要两个风值的线条,我也希望我的点在风的梯度中着色,以反映原始值,点应该如下所示:
ggplot(airquality, aes(x=Solar.R,y=Ozone,color=Wind))+
geom_point()+
scale_color_gradient(low = "#90da90", high = "red3")+
theme_minimal()
但我不能让这两件事在同一个情节中发挥作用
我有过几次不成功的试验,大多数都是这种
visreg(fit,"Solar.R","Wind",
overlay=TRUE,breaks = 2,gg=TRUE,
partial=FALSE,rug=FALSE)+
scale_color_manual(values = c("#90da90", "red3"))+
scale_fill_manual(values = c("gray", "gray"))+
geom_point(aes(color=Wind))+
scale_color_gradient(low = "#90da90", high = "red3")+
theme_minimal()
但以某种方式,我得到了一个与第三个变量的大小相关的错误
有人知道怎么做吗?拜托,我的想象力已经用完了.