The warning contained in layout help is
These functions are completely incompatible with other mechanisms for organizing charts on the device: par (mfrow), par (mfcol)
Unfortunately, pairs uses mfrow to place charts.
Using the hints of Duncan Murdoch and Uwe Ligges on R help , you can set oma to a reasonable value to give you a place for a legend from the side, for example
pairs(iris[1:4], main = "Anderson Iris Data -- 3 species", pch = 21, bg = c("red", "green3", "blue")[iris$Species], oma=c(4,4,6,12))

source share