📜  如何在多个图上放置图例 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:51.380000             🧑  作者: Mango

代码示例1
reset <- function() {
    par(mfrow=c(1, 1), oma=rep(0, 4), mar=rep(0, 4), new=TRUE)
    plot(0:1, 0:1, type="n", xlab="", ylab="", axes=FALSE)
    }

reset()
legend("top", legend=c("A", "B"), fill=c("red", "blue"), ncol=2, bty="n")

# creates an invisible plot on top of the others and places the legend afterwords.