Rounded border around plot in R

border, r

Solution

library(grid)

plot(0:10, 0:10, type="n", xlab="X", ylab="Y")
grid.roundrect(gp=gpar(fill="#00000000", col="grey"))

If you find the borders are being cut off, you can always reduce the size of the rounded rectangle:

plot(0:10, 0:10, xlab="X", ylab="Y")
grid.roundrect(height=0.99, width=0.99, gp=gpar(fill="#00000000", col="grey"))

Problem

I need to put smooth border around plot. code ``` plot(0:10, 0:10, type="n", xlab="X", ylab="Y") box("figure", col="blue") ``` instead of simple blue line, how i can put smooth grey line with rounded corners? many thanks.

Original source