12

当我使用segments()R 绘制线段时,末端总是呈圆形。我怎样才能把两端改成平的?

4

1 回答 1

18

来自?par

 ‘lend’ The line end style.  This can be specified as an integer or
      string:

      ‘0’ and ‘"round"’ mean rounded line caps [_default_];

      ‘1’ and ‘"butt"’ mean butt line caps;

      ‘2’ and ‘"square"’ mean square line caps.

例如:

plot(0:1,0:1,type="n")
par(lend=0); segments(0,0.2,1,0.2,lwd=8)
par(lend=1); segments(0,0.4,1,0.4,lwd=8)
par(lend=2); segments(0,0.6,1,0.6,lwd=8)

segments(0,0.2,1,0.2,lwd=8, lend=1)等等。 在此处输入图像描述

(您必须非常仔细地看才能看到区别,尤其是“对接”和“方形”大写之间)

于 2012-06-08T07:12:34.987 回答