Rounded border around plot in R

南笙酒味 提交于 2020-01-04 05:10:33

问题


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.


回答1:


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"))



来源:https://stackoverflow.com/questions/11663382/rounded-border-around-plot-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!