1
這是我可重現的代碼示例。除了軸標題/標籤沒有被添加以外,一切看起來都應該如圖所示。儘管遵循了函數文檔中的指導,但我很努力想辦法解決這個問題。幫助將非常感謝 - 事先感謝。在gplot中使用filled.contour在R中添加軸標題R
output <- matrix(data = c(0.7,0.5,0.3,0.8,0.6,0.4,0.9,0.7,0.5,1,0.8,0.6),nrow=3,
ncol=4)
# Change column names
colnames(output) <- c(10,20,30,40)
# Change row names
rownames(output) <- c(1,2,3)
library(gplots)
matrix.axes <- function(data) {
# Do the rows, las=2 for text perpendicular to the axis
x <- (1:dim(data)[1] - 1)/(dim(data)[1] - 1);
axis(side=1, at=x, labels=rownames(data), las=1);
# Do the columns
x <- (1:dim(data)[2] - 1)/(dim(data)[2] - 1);
axis(side=2, at=x, labels=colnames(data), las=2);
}
# Not necessary to save as pdf unless this is part of the problem
# save to pdf
# pdf("C:/Test.pdf")
# Plot results
filled.contour(output,plot.title=title(main="Method"),
xlab='Case number',ylab='Sample number',
plot.axes=matrix.axes(output))
# dev.off()
我已經刪除保存在自己的代碼的PDF,因爲這是沒有必要複製您的問題(或至少當編輯是同行評審的時候) – Phil