我绘制了一个等高线图并添加了一条对角线:
图书馆(MASS)库(场)x< - c(21.06,28.89,23.00,23.61,23.61,22.83,30.44)y< - c(26.56,24.00,13.06,18.61,18.61,14.17,25.33)z& …
你可以扔掉 abline 在那里:
abline
library(MASS) x <- c(21.06, 28.89, 23.00, 23.61, 23.61, 22.83, 30.44) y <- c(26.56, 24.00, 13.06, 18.61, 18.61, 14.17, 25.33) z <- kde2d(x, y, n = 32, lims = c(0, 32, 0, 32)) filled.contour(z, plot.title={ title(main = "Density estimation: contour plot") title(xlab=expression(alpha),cex.lab=2) mtext(expression(beta),2,cex=2,line=3,las=1) abline(0, 1, col = "red", lwd = 2) })
或者(正如评论中所建议的那样),你最好做一些事情:
filled.contour( z, plot.title = { title(main = "Density estimation: contour plot") title(xlab = expression(alpha), cex.lab = 2) mtext(expression(beta), 2, cex = 2, line = 3, las = 1) }, plot.axes = { abline(0, 1, col = "red", lwd = 2) } )
只是因为感觉有点奇怪 abline 在 plot.title 。
plot.title