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). plot in different sizes. note legend overlapping plot area on right side of figure.

how can achieve no overlapping legend varying plot sizes (or width/height ratios)? highly appreciate on problem!


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -