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. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 11:31 19/09/00 -0700, you 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 endcaps,>unlike X11.Hi, This is a behaviour I already noticed under Windows NT when using plot(..., type="h", lwd=10), so that the thickness of the lines is expanded all around their starting- and end-points, rather than only perpandicularly to the lines (which was what I expected). A workaround for the example you give is to use rect() thi <- 0.025 plot(0:1) rect(1.5-thi, 0, 1.5+thi, 0.5, col="red", border="red") rect(1.5-thi, 0.5, 1.5+thi, 1, col="green", border="green") abline(h=0); abline(h=0.5); abline(h=1) Emmanuel Paradis -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Date: Wed, 20 Sep 2000 10:50:08 +0200 > To: Trent Piepho <xyzzy at speakeasy.org> > From: Emmanuel Paradis <paradis at isem.univ-montp2.fr> > Subject: Re: [R] getting lines with non-rounded caps? > Cc: r-help at stat.math.ethz.ch > > At 11:31 19/09/00 -0700, you 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. > > Hi, > > This is a behaviour I already noticed under Windows NT when using plot(..., > type="h", lwd=10), so that the thickness of the lines is expanded all > around their starting- and end-points, rather than only perpandicularly to > the lines (which was what I expected). A workaround for the example you > give is to use rect()It may be what you expected, but it is not what normally happens in computer graphics. The idea is that the line is drawn with a round pen of radius lwd. If you use a flat-ended pen, you get problems when a line changes direction discontinuously (and polylines do), as the line appears half-broken on the outside. PostScript has different options for the internal changes of direction (setlinejoin) and the ends (setlinecap). So does X11, and I see that the devX11 device uses JoinRound, and CapRound if lty=0 otherwise CapButt. Is there a case for adding cap-style and join-style to the line type options? I am not sure if all the devices could support them. In particular, I don't know if it is possible to achieve different internal and end effects under the Windows graphics model. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Seemingly Similar Threads
- R cairo_pdf function does not respect plotting boundaries
- R cairo_pdf function does not respect plotting boundaries
- [R] [FORGED] R cairo_pdf function does not respect plotting boundaries
- get plot axis rounding method
- clipped lines have wrong slope in log plot (PR#839)