Robert Offinger
2006-Jun-04 15:23 UTC
[R] slanted ends of horizontal lines for certain line widths
Hello, if I plot a horizontal line, e.g., plot(c(1,2),c(1,1),xlim=c(0,3),lwd=2,type="l") or plot(c(1,2),c(1,1),xlim=c(0,3),lwd=4,type="l") then the left end (1st example) or both ends (2nd example) of the lines are not rectangular but slanted on the graphical display (screen). That behavour first occurred when I was trying to plot a stepfun, e.g., y <- round(rnorm(12),1) Fn12 <- ecdf(y) plot(Fn12,verticals= FALSE, do.p = FALSE,lwd=2,col.h="red") plot(Fn12,verticals= FALSE, do.p = FALSE,lwd=4,col.h="red") (lwd=3 seems okay) Bug or feature? Suggestions? (I don't like the slanted ends but lwd=2 would be better than lwd=3) Robert Offinger OvG-Universit?t Magdeburg ---- platform sparc-sun-solaris2.9 arch sparc os solaris2.9 system sparc, solaris2.9 status major 2 minor 3.1 year 2006 month 06 day 01 svn rev 38247 language R version.string Version 2.3.1 (2006-06-01)
Charles Annis, P.E.
2006-Jun-04 15:43 UTC
[R] slanted ends of horizontal lines for certain line widths
I think you want to change par()$lend Type par() <enter> to see the defaults. In your situation you might want to begin with something like dev.off() par(mar=c(4,6,4,5)+0.1, lend=2) ... then your plotting logic ... Where the "mar" argument adjusts the margins. (You can omit this if you're happy with the defaults.) And the line end, lend=2, makes the ends square. Best wishes. Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Robert Offinger Sent: Sunday, June 04, 2006 11:24 AM To: r-help at stat.math.ethz.ch Subject: [R] slanted ends of horizontal lines for certain line widths Hello, if I plot a horizontal line, e.g., plot(c(1,2),c(1,1),xlim=c(0,3),lwd=2,type="l") or plot(c(1,2),c(1,1),xlim=c(0,3),lwd=4,type="l") then the left end (1st example) or both ends (2nd example) of the lines are not rectangular but slanted on the graphical display (screen). That behavour first occurred when I was trying to plot a stepfun, e.g., y <- round(rnorm(12),1) Fn12 <- ecdf(y) plot(Fn12,verticals= FALSE, do.p = FALSE,lwd=2,col.h="red") plot(Fn12,verticals= FALSE, do.p = FALSE,lwd=4,col.h="red") (lwd=3 seems okay) Bug or feature? Suggestions? (I don't like the slanted ends but lwd=2 would be better than lwd=3) Robert Offinger OvG-Universit?t Magdeburg ---- platform sparc-sun-solaris2.9 arch sparc os solaris2.9 system sparc, solaris2.9 status major 2 minor 3.1 year 2006 month 06 day 01 svn rev 38247 language R version.string Version 2.3.1 (2006-06-01) ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Dimitrios Rizopoulos
2006-Jun-04 15:53 UTC
[R] slanted ends of horizontal lines for certain line widths
probably you want to look at the `lend' argument of ?par, e.g., op <- par(lend = 2) plot(c(1,2), c(1,1), xlim = c(0,3), lwd = 20, type = "l") par(op) I hope it helps. Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm Quoting Robert Offinger <rooff at merkur.math.uni-magdeburg.de>:> Hello, > > if I plot a horizontal line, e.g., > > plot(c(1,2),c(1,1),xlim=c(0,3),lwd=2,type="l") > > or > > plot(c(1,2),c(1,1),xlim=c(0,3),lwd=4,type="l") > > then the left end (1st example) or both ends (2nd example) of the > lines > are not rectangular but slanted on the graphical display (screen). > That behavour first occurred when I was trying to plot a stepfun, > e.g., > > y <- round(rnorm(12),1) > Fn12 <- ecdf(y) > plot(Fn12,verticals= FALSE, do.p = FALSE,lwd=2,col.h="red") > plot(Fn12,verticals= FALSE, do.p = FALSE,lwd=4,col.h="red") > > (lwd=3 seems okay) > > Bug or feature? > Suggestions? (I don't like the slanted ends but lwd=2 would be > better > than lwd=3) > > Robert Offinger > OvG-Universit?t Magdeburg > > ---- > platform sparc-sun-solaris2.9 > arch sparc > os solaris2.9 > system sparc, solaris2.9 > status > major 2 > minor 3.1 > year 2006 > month 06 > day 01 > svn rev 38247 > language R > version.string Version 2.3.1 (2006-06-01) > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm