【发布时间】:2015-12-10 16:55:26
【问题描述】:
除了xlab 之外,我还想在 3 x 3 条形图面板中包含刻度线。我为单个图尝试了this 解决方案,但不知何故我在复制它时遇到了麻烦。这个想法是用从-3到+3的d标记每个条,增加一个单位。每个图中的第一个条形代表 -3 的值。我试图用下面的模拟数据来证明我的问题。有任何想法吗?
# Data generation
# Populating a matrix
matrix(rnorm(63, 1:9), nrow=7, byrow=TRUE)
# Labelling the matrix
colnames(mat.s) <- c("Hs", "Sex", "Es", "Bo", "R", "W", "S", "Pri", "Abo")
# Tick mark indicator
d <- seq(-3,3,1)
# Plotting estimates
par(mfrow=c(3,3), mar = c(4,3,3,1))
for(i in 1:9) {
# Bar plot
barplot(mat.s[,i],
# X-label
xlab = colnames(mat.s)[i])
}
【问题讨论】:
-
它必须以 R 为基础吗?你能证明你实施了解决方案吗?
-
要创建矩阵,可以
matrix(rnorm(63, 1:9), nrow=7, byrow=TRUE)。