Answers for "how to place a legend on top of multiple plots"

1

how to place a legend on top of multiple plots

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.
Posted by: Guest on September-15-2020

Code answers related to "how to place a legend on top of multiple plots"

Browse Popular Code Answers by Language