[R] getting lines with non-rounded caps?

Martina Erdbrügge erdbruegge at statistik.uni-dortmund.de
Wed Sep 20 08:37:45 CEST 2000


Trent Piepho wrote:
> 
> I'm trying to get a plot with wide lines that don't have rounded end caps.
> You can see the effect quite clearly with a plot like this:
> 
> plot(0:1)
> lines(c(1.5,1.5),c(0,.5),lwd=20,col="red")
> lines(c(1.5,1.5),c(.5,1),lwd=20,col="green")
> abline(h=0)
> abline(h=0.5)
> abline(h=1)
> 
> The colored lines should be between the horizontal lines, but because of the
> rounded end caps, they aren't.
> 
> Under X11, if I set lty to something like "F0", the end caps are turned off.
> Unfortunately, the "0" appears to get ignored, and the line style is the same
> as "FF", i.e. 16 units of drawn line, then 16 units of space.
> 
> With the postscript device, lines styles like "FF" still get rounded end caps,
> unlike X11.


You could use e.g.

plot(0:1, type = "n")
polygon(x = c(1.48, 1.52, 1.52, 1.48, 1.48), y = c(0, 0, 0.5, 0.5, 0),
col = "red")
polygon(x = c(1.48, 1.52, 1.52, 1.48, 1.48), y = c(0.5, 0.5, 1, 1, 0.5),
col = "green")

to avoid rounded caps. Don't know whether that's what you want, but ...


Martina
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list