在xgplot2中将x = y行添加到hexplot

Cad*_*ama 7 visualization r ggplot2

您好我正在尝试通过在ggplot中使用hexplots来查看可视化数据集的不同方法.我基本上想要一个带有1.黄土线2的十六进制图.回归线3.x = y线 - >相当于abline(0,1)

到目前为止,我已经提出了这种代码:

c <- ggplot(mtcars, aes(qsec, wt))
c+stat_binhex()+stat_smooth(method="loess", colour="red")+stat_smooth(method='lm', se=FALSE, colour="orange")+ geom_abline(intercept=0, slope=1)
Run Code Online (Sandbox Code Playgroud)

这给出了下图,但我仍然没有看到x = y参考线.请帮忙.我不确定为什么它不起作用.谢谢

在此输入图像描述

top*_*hef 19

y = x参考线不在您绘制的坐标范围内.如果你改为

geom_abline(slope=1, intercept=-15)
Run Code Online (Sandbox Code Playgroud)

你会在情节上看到你的线.

  • 你看过我的第一句话吗?y=x 超出您的情节范围。 (2认同)