With a modified graphic segment ends from round to flat

When I use segments() to draw a segment using R, the ends always seem rounded. How can I change the ends to even ones?

+7
source share
1 answer

From ?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. 

For example:

 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) 

or segments(0,0.2,1,0.2,lwd=8, lend=1) , etc. enter image description here

(You should look quite carefully to see the difference, especially between the β€œbutt” and the β€œsquare” caps)

+11
source

All Articles