hist.panel = function (x, ...=NULL ) { par(new = TRUE) hist(x, col = "#D8EAF6", probability = TRUE, axes = FALSE, main = "", breaks = "FD", xlab = "Variable Name", ylab = "Count") #col = "light gray", breaks = "FD"绘制对角线柱状图底部x分布图 lines(density(x, na.rm=TRUE), col = "red", lwd = 1) #lines(f, col="blue", lwd=1, lty=1) how to add gaussian normal overlay? rug(x) }每个格子只要左边、下边的坐标轴,不要右边和上边的坐标轴,并且将左边及下边的坐标轴颜色改为浅灰色,求代码,谢谢
时间: 2023-11-15 15:04:12 浏览: 137
你可以使用`axis()`函数来控制坐标轴的显示。具体来说,`side`参数控制坐标轴的位置,`col.axis`参数控制坐标轴的颜色。下面是修改后的代码:
```
hist.panel = function (x, ...=NULL ) {
par(new = TRUE)
hist(x,
col = "#D8EAF6",
probability = TRUE,
axes = FALSE,
main = "",
breaks = "FD",
xlab = "Variable Name",
ylab = "Count")
#col = "light gray", breaks = "FD"
# 绘制对角线柱状图底部x分布图
lines(density(x, na.rm=TRUE), col = "red", lwd = 1)
#lines(f, col="blue", lwd=1, lty=1) how to add gaussian normal overlay?
rug(x)
# 只显示左边和下边的坐标轴
axis(side = 1, col.axis = "lightgray")
axis(side = 2, col.axis = "lightgray")
}
```
阅读全文