我想在我的hexbinplot上添加标准的1:1行(截距0和斜率1)和一些文本(例如R-square).试用代码可能是这样的
require(hexbin)
x1 <- rnorm(10000)
x2 <- rnorm(10000)
df <- data.frame(cbind(x1, x2))
hex <- hexbin(x1, x2, xbins = 300)
hexbinplot(x2 ~ x1, data = df, aspect = '1', xbins = 300, xlim = c(-5, 5), ylim = c(-5, 5))
hexVP.abline(hexViewport(hex), 0, 1)
Run Code Online (Sandbox Code Playgroud)
添加的行有两个问题
另一个问题是如何在情节上添加文字.