在R中手动创建一个绘图框

tim*_*kas 1 plot r frame

我需要在R中控制基本xy图的样式,因此构建绘图区域如下:

frame()
plot.window(xlim=c(0,1), ylim=c(-.6, .8))
axis(1, at=c(0, .2, .4, .6, .8, 1.0), lwd=2)
axis(2, at=c(-.6, -.4, -.2, 0, .2, .4, .6, .8), lwd=2)
Run Code Online (Sandbox Code Playgroud)

但是,我无法弄清楚如何在该图周围创建一个物理框架(lwd = 2).是否可以(必要?)使用line()polygon()?或者有更内置的内容吗?

我也对如何更改使用该plot()函数创建的绘图的框架和轴权重感兴趣.

Rei*_*son 5

你可能意味着box():

frame()
plot.window(xlim=c(0,1), ylim=c(-.6, .8))
axis(1, at=c(0, .2, .4, .6, .8, 1.0), lwd=2)
axis(2, at=c(-.6, -.4, -.2, 0, .2, .4, .6, .8), lwd=2)
box(lwd = 2)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述