Exact position of legend above R plot -
i want produce simple plot legend on top right above plot (see picture below, plot on left). can achieve using following simple example:
par(mar = c(4, 4, 1.5, 4)) plot(rnorm(50)) par(oma = c(0, 0, 0, 0), mar = c(0, 0, 0, 4), new = true) plot(0, 0, type = "n", bty = "n", axes = f) legend(x = "topright", "data", bty = "n", pch = 1, xpd = t, horiz = t)
when scale plot different sizes legend overlaps plot area though (plot on right).
how can achieve no overlapping legend varying plot sizes (or width/height ratios)? highly appreciate on problem!
Comments
Post a Comment