我想在面板B中创建一个图像,其中红色数字给出了条形的排名。我在下面的代码允许我生成面板A. 如何调整下面的代码以便在面板B中给出红色标签?
R代码(适用于A组):可重现的示例代码
# load necessary libraries
library(lattice)
library(latticeExtra)
# create dataframe
df.test <- data.frame(matrix(NA, nrow=9, ncol=4))
names(df.test) <- c("x", "y", "z", "z.rank")
# fill dataframe
df.test$x <- factor(rep(c("X1", "X2", "X3"), times=3), levels=c("X1", "X2", "X3"))
df.test$y <- factor(rep( paste0("Y", 1:3), each=3), levels=c("Y1", "Y2", "Y3"))
set.seed(2); df.test$z <- abs(rnorm(9, 0, 1))
# labels (rankings of z, from largest to smallest)
df.test$z.rank <- as.numeric(rank(df.test$z))
# plot 1 (bars)
p1. <- cloud(z~x+y, data=df.test, panel.3d.cloud=panel.3dbars,
ylab="Y", xlab="X", zlab="Z",
xbase=0.2, ybase=0.2, scales=list(arrows=FALSE, col="black", distance=1),
par.settings = list(axis.line = list(col = "transparent")),
screen = list(z = 35, x = -35, y=0),
alpha.facet = 1.00, border = "transparent",
zoom=1.00);
print(p1)