Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 交互绘图的手动比例值不足:ggplot2错误_R_Plot_Ggplot2_Colors_Interaction - Fatal编程技术网

R 交互绘图的手动比例值不足:ggplot2错误

R 交互绘图的手动比例值不足:ggplot2错误,r,plot,ggplot2,colors,interaction,R,Plot,Ggplot2,Colors,Interaction,我正在ggplot2中创建交互图,并不断出现错误-错误:手动比例中的值不足。需要4个,但仅提供2个 守则: plot1<- data.frame(effect("current*child", outcome, xlevels=list(child=c(-1,1)))) ggplot(plot1) + geom_line(aes(current, fit, color = child, linetype=factor(current)), size= 1.25, )+ scale_c

我正在ggplot2中创建交互图,并不断出现错误-错误:手动比例中的值不足。需要4个,但仅提供2个

守则:

plot1<- data.frame(effect("current*child", outcome, 
xlevels=list(child=c(-1,1))))
ggplot(plot1) + geom_line(aes(current, fit,  color = child, 
linetype=factor(current)), size= 1.25, )+ scale_colour_gradient(low = 
"darkred", high = "darkblue") + theme_bw()+
coord_cartesian(xlim=c(-10,10), ylim=c(-10,10)) +
scale_linetype_manual(values=c("solid", "dotted"))+
theme(legend.position='none', panel.grid.major = element_blank(),
    text = element_text(size=16),
    panel.grid.minor = element_blank(),)+ 
xlab("Current")+ylab("Outcome") 

plot1请提供一个数据框的dput输出的可复制示例。它更可能与
scale\u linetype\u手册(值=c(“实心”、“虚线”)
有关。但是特别是在请求绘图帮助时,您需要包含一个示例输入数据,以便我们可以运行代码来查看发生了什么。