我想制作一个比较图,比较两个变量,并在两个产品的
以下是代码:
geom_smooth()
上叠加。测量理论需要以(x=0;y=0)
为起点,但是当我制作图表时,使用geom_smooth()
创建的蓝色回归线并没有通过坐标 (0;0)
。是否可能对此geom_smooth()
进行修正,使其固定在定义的第一个点(0;0)的特定坐标处?以下是代码:
library(ggplot2)
RawData <- data.frame(
"Time" = c(0, 3, 6, 9, 24, 30, 34, 48, 57, 0, 3, 6, 9, 24, 30, 34, 48, 57),
"Curing" = c(0, 11.36, 31.81, 34.09, 75, 86.36, 97.7, 100, 100, 0, 77.5, 92, 95, 98, 100, 100, 100, 100),
"Grade" = c("Product A", "Product A", "Product A", "Product A", "Product A", "Product A", "Product A", "Product A", "Product A", "Product B", "Product B", "Product B", "Product B", "Product B", "Product B", "Product B", "Product B", "Product B"))
attach(RawData)
Graph <- ggplot(data=RawData, aes(x=`Time`, y=`Curing`, col=Grade)) +
geom_point(aes(color = Grade), shape = 1, size = 2.5) +
geom_smooth(level=0.50, span = 0.9999999999) +
scale_color_manual(values=c('#f92410','#644196')) +
xlab("Tempo espresso in ore") +
ylab("% Di reticolazione") +
labs(color='') +
theme(legend.justification = "top")
Graph + geom_rug(aes(color = Grade))
感谢您提前的任何帮助!!