qplot(x=Data$Weight, geom="histogram", main = "Weight distribution for Y Goods", binwidth = 0.5, xlab = "Weight of Y Goods", fill=I("blue"), col=I("red"), alpha=I(0.2), xlim=c(0,5))
布雷特乔森
尝试添加,fill = Data$Buy_Flag使您的绘图代码如下所示:
qplot(
x = Data$Weight,
fill = Data$Buy_Flag,
geom = "histogram",
main = "Weight distribution for Y Goods",
binwidth = 0.5,
xlab = "Weight of Y Goods",
fill = I("blue"),
col = I("red"),
alpha = I(0.2),
xlim = c(0, 5)
)
我来说两句