Re: [R] short plots: lwd, margin and postscript behavior
I tested in R versions 1.8.1 and 2, but doesn't works. The attached plots can explain this. And mar isn't a parameter to postscript command. If I use in par, it doesn't affect the outpu. Thanks, C. --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: Hi all. I'm working with a short plot (3x3 inches), but the results (via postscript command) are not nice. The lwd command don't affect the lines (that are very large) and the margins don't change using oma, mai, mar, ... Below I put an example. Moreover, save the graphics via postscript command isn't working well (see the attached ps). Thanks by the help, Setting lwd=0.5 works for me, as well as using par(mar=c()) Cezar Freitas. #Example: #data scores-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0, 5.0, 2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0, 3.0, 3.0) q-summary(scores) gra-hist(scores, breaks=((0:11)/2-.2), plot=FALSE) yy-ceiling(max(gra$counts)/10)*10 yz-yy/12 #plot via postscript postscript(test.ps, width=3, height=3, horizontal=FALSE, family=Times, paper=special) par(mar=rep(1,4)+.1, lwd=0.5) hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6), ylim=c(-yz,yy), main=scores, ylab=Freq, xlab=math, cex.axis=.3, cex.main=.3, cex.sub=.3, cex.lab=.3, mgp=c(1.5,.5,0)) add lwd=0.5 Uwe Ligges boxplot(scores, horizontal=1, add=1, at=-2*yz/3, boxwex=1.5*yz, bty=n, axes=FALSE) points(q[4], -2*yz/3, col=1, pch=+, cex=.5) dev.off() ___ __ R-help@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 __ R-help@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
Re: [R] short plots: lwd, margin and postscript behavior
Thank you so much, but the commands in par doesn't affect the pictures generated by postscript. For example, I put lwd=3, and the postscript file is the same, using par(lwd=3) or par(lwd=.5)... --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: I tested in R versions 1.8.1 and 2, but doesn't works. The attached plots can explain this. And mar isn't a parameter to postscript command. If I use in par, it doesn't affect the outpu. It does in R-2.0.1!!! Please try out what poeple are suggesting! You have to set par() for the current device, so after your call to postscript, as I have indicated below. Uwe Ligges Thanks, C. --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: Hi all. I'm working with a short plot (3x3 inches), but the results (via postscript command) are not nice. The lwd command don't affect the lines (that are very large) and the margins don't change using oma, mai, mar, ... Below I put an example. Moreover, save the graphics via postscript command isn't working well (see the attached ps). Thanks by the help, Setting lwd=0.5 works for me, as well as using par(mar=c()) Cezar Freitas. #Example: #data scores-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0, 5.0, 2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0, 3.0, 3.0) q-summary(scores) gra-hist(scores, breaks=((0:11)/2-.2), plot=FALSE) yy-ceiling(max(gra$counts)/10)*10 yz-yy/12 #plot via postscript postscript(test.ps, width=3, height=3, horizontal=FALSE, family=Times, paper=special) par(mar=rep(1,4)+.1, lwd=0.5) hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6), ylim=c(-yz,yy), main=scores, ylab=Freq, xlab=math, cex.axis=.3, cex.main=.3, cex.sub=.3, cex.lab=.3, mgp=c(1.5,.5,0)) add lwd=0.5 Uwe Ligges boxplot(scores, horizontal=1, add=1, at=-2*yz/3, boxwex=1.5*yz, bty=n, axes=FALSE) points(q[4], -2*yz/3, col=1, pch=+, cex=.5) dev.off() ___ __ R-help@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 ___ rápida e grátis __ R-help@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
Re: [R] short plots: lwd, margin and postscript behavior
Don't feel alone Cézar; I have had the same problems getting par commands to work when making *.pdf files. I also run R 2.0.1 and use par() after opening the device. Sometimes, the par() commands work; sometimes it opens a new windows device. Maybe something with MS Windows is causing this. Mike Mike Saunders Research Assistant Forest Ecosystem Research Program Department of Forest Ecosystem Sciences University of Maine Orono, ME 04469 207-581-2763 (O) 207-581-4257 (F) - Original Message - From: Cézar Freitas [EMAIL PROTECTED] To: Uwe Ligges [EMAIL PROTECTED]; R-help@stat.math.ethz.ch Sent: Thursday, February 17, 2005 8:36 AM Subject: Re: [R] short plots: lwd, margin and postscript behavior Thank you so much, but the commands in par doesn't affect the pictures generated by postscript. For example, I put lwd=3, and the postscript file is the same, using par(lwd=3) or par(lwd=.5)... --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: I tested in R versions 1.8.1 and 2, but doesn't works. The attached plots can explain this. And mar isn't a parameter to postscript command. If I use in par, it doesn't affect the outpu. It does in R-2.0.1!!! Please try out what poeple are suggesting! You have to set par() for the current device, so after your call to postscript, as I have indicated below. Uwe Ligges Thanks, C. --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: Hi all. I'm working with a short plot (3x3 inches), but the results (via postscript command) are not nice. The lwd command don't affect the lines (that are very large) and the margins don't change using oma, mai, mar, ... Below I put an example. Moreover, save the graphics via postscript command isn't working well (see the attached ps). Thanks by the help, Setting lwd=0.5 works for me, as well as using par(mar=c()) Cezar Freitas. #Example: #data scores-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0, 5.0, 2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0, 3.0, 3.0) q-summary(scores) gra-hist(scores, breaks=((0:11)/2-.2), plot=FALSE) yy-ceiling(max(gra$counts)/10)*10 yz-yy/12 #plot via postscript postscript(test.ps, width=3, height=3, horizontal=FALSE, family=Times, paper=special) par(mar=rep(1,4)+.1, lwd=0.5) hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6), ylim=c(-yz,yy), main=scores, ylab=Freq, xlab=math, cex.axis=.3, cex.main=.3, cex.sub=.3, cex.lab=.3, mgp=c(1.5,.5,0)) add lwd=0.5 Uwe Ligges boxplot(scores, horizontal=1, add=1, at=-2*yz/3, boxwex=1.5*yz, bty=n, axes=FALSE) points(q[4], -2*yz/3, col=1, pch=+, cex=.5) dev.off() ___ __ R-help@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 ___ rápida e grátis __ R-help@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 __ R-help@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
Re: [R] short plots: lwd, margin and postscript behavior
Mike Saunders wrote: Don't feel alone Cézar; I have had the same problems getting par commands to work when making *.pdf files. I also run R 2.0.1 and use par() after opening the device. Sometimes, the par() commands work; sometimes it opens a new windows device. Maybe something with MS Windows is causing this. Which version of Windows (I assume NT, 2k or XP; each with latest Service Pack), which version of R (I assume R-2.0.1)? Please start R with --vanilla and tell us exactly the sequence of calls until this happens, if it is reproducible in any way... Uwe Ligges Mike Mike Saunders Research Assistant Forest Ecosystem Research Program Department of Forest Ecosystem Sciences University of Maine Orono, ME 04469 207-581-2763 (O) 207-581-4257 (F) - Original Message - From: Cézar Freitas [EMAIL PROTECTED] To: Uwe Ligges [EMAIL PROTECTED]; R-help@stat.math.ethz.ch Sent: Thursday, February 17, 2005 8:36 AM Subject: Re: [R] short plots: lwd, margin and postscript behavior Thank you so much, but the commands in par doesn't affect the pictures generated by postscript. For example, I put lwd=3, and the postscript file is the same, using par(lwd=3) or par(lwd=.5)... --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: I tested in R versions 1.8.1 and 2, but doesn't works. The attached plots can explain this. And mar isn't a parameter to postscript command. If I use in par, it doesn't affect the outpu. It does in R-2.0.1!!! Please try out what poeple are suggesting! You have to set par() for the current device, so after your call to postscript, as I have indicated below. Uwe Ligges Thanks, C. --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: Hi all. I'm working with a short plot (3x3 inches), but the results (via postscript command) are not nice. The lwd command don't affect the lines (that are very large) and the margins don't change using oma, mai, mar, ... Below I put an example. Moreover, save the graphics via postscript command isn't working well (see the attached ps). Thanks by the help, Setting lwd=0.5 works for me, as well as using par(mar=c()) Cezar Freitas. #Example: #data scores-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0, 5.0, 2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0, 3.0, 3.0) q-summary(scores) gra-hist(scores, breaks=((0:11)/2-.2), plot=FALSE) yy-ceiling(max(gra$counts)/10)*10 yz-yy/12 #plot via postscript postscript(test.ps, width=3, height=3, horizontal=FALSE, family=Times, paper=special) par(mar=rep(1,4)+.1, lwd=0.5) hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6), ylim=c(-yz,yy), main=scores, ylab=Freq, xlab=math, cex.axis=.3, cex.main=.3, cex.sub=.3, cex.lab=.3, mgp=c(1.5,.5,0)) add lwd=0.5 Uwe Ligges boxplot(scores, horizontal=1, add=1, at=-2*yz/3, boxwex=1.5*yz, bty=n, axes=FALSE) points(q[4], -2*yz/3, col=1, pch=+, cex=.5) dev.off() ___ __ R-help@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 ___ rápida e grátis __ R-help@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 __ R-help@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 __ R-help@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
Re: [R] short plots: lwd, margin and postscript behavior
Time for a completely reproducible example a la the posting guide. Plese show us _exactly_ what you did that does not work for you: your original posting did not have lwd in the example. On Thu, 17 Feb 2005, Cézar Freitas wrote: Thank you so much, but the commands in par doesn't affect the pictures generated by postscript. For example, I put lwd=3, and the postscript file is the same, using par(lwd=3) or par(lwd=.5)... --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: I tested in R versions 1.8.1 and 2, but doesn't works. The attached plots can explain this. And mar isn't a parameter to postscript command. If I use in par, it doesn't affect the outpu. It does in R-2.0.1!!! Please try out what poeple are suggesting! You have to set par() for the current device, so after your call to postscript, as I have indicated below. Uwe Ligges Thanks, C. --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: Hi all. I'm working with a short plot (3x3 inches), but the results (via postscript command) are not nice. The lwd command don't affect the lines (that are very large) and the margins don't change using oma, mai, mar, ... Below I put an example. Moreover, save the graphics via postscript command isn't working well (see the attached ps). Thanks by the help, Setting lwd=0.5 works for me, as well as using par(mar=c()) Cezar Freitas. #Example: #data scores-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0, 5.0, 2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0, 3.0, 3.0) q-summary(scores) gra-hist(scores, breaks=((0:11)/2-.2), plot=FALSE) yy-ceiling(max(gra$counts)/10)*10 yz-yy/12 #plot via postscript postscript(test.ps, width=3, height=3, horizontal=FALSE, family=Times, paper=special) par(mar=rep(1,4)+.1, lwd=0.5) hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6), ylim=c(-yz,yy), main=scores, ylab=Freq, xlab=math, cex.axis=.3, cex.main=.3, cex.sub=.3, cex.lab=.3, mgp=c(1.5,.5,0)) add lwd=0.5 Uwe Ligges boxplot(scores, horizontal=1, add=1, at=-2*yz/3, boxwex=1.5*yz, bty=n, axes=FALSE) points(q[4], -2*yz/3, col=1, pch=+, cex=.5) dev.off() -- Brian D. Ripley, [EMAIL PROTECTED] 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 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@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
Re: [R] short plots: lwd, margin and postscript behavior
As I have already seen several times in this thread: * par() applies to the current device. * Setting it before postscript() will have no effect on the postscript plot. I am not at all sure what you are using fin= for, but that is what you are seeing the effects of in the margins on-screen. Your margins are too small and your title text is too small, but that is what you asked for The posting guide does give good advice: please spend an hour or so reading it and its references. On Thu, 17 Feb 2005, Cézar Freitas wrote: OK. I'll put the two forms and the results in two attaches. There are two problems: the main is the plots saved via postscript command have large lines (lwd doesn't works). The other one is the big margins. Thanks, C. PS: two attached pictures #data par(fin=c(3,3)) scores-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0, 5.0, 2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0, 3.0, 3.0) q-summary(scores) gra-hist(scores, breaks=((0:11)/2-.2), plot=FALSE) yy-ceiling(max(gra$counts)/10)*10 yz-yy/12 #picture saved via windows gui par(mai=rep(.2,4), lwd=.5, fin=c(3,3)) hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6), ylim=c(-yz,yy), main=scores, ylab=Freq, xlab=math, cex.axis=.3, cex.main=.3, cex.sub=.3, cex.lab=.3, mgp=c(1.5,.5,0), lwd=.5) boxplot(scores, horizontal=1, add=1, at=-2*yz/3, boxwex=1.5*yz, bty=n, axes=FALSE) points(q[4], -2*yz/3, col=1, pch=+, cex=.5) #picture saved via postscript command par(mai=rep(.2,4), lwd=.5, fin=c(3,3)) postscript(test.ps, width=3, height=3, horizontal=FALSE, family=Times, paper=special) hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6), ylim=c(-yz,yy), main=scores, ylab=Freq, xlab=math, cex.axis=.3, cex.main=.3, cex.sub=.3, cex.lab=.3, mgp=c(1.5,.5,0), lwd=.5) boxplot(scores, horizontal=1, add=1, at=-2*yz/3, boxwex=1.5*yz, bty=n, axes=FALSE) points(q[4], -2*yz/3, col=1, pch=+, cex=.5) dev.off() --- Prof Brian Ripley [EMAIL PROTECTED] escreveu: Time for a completely reproducible example a la the posting guide. Plese show us _exactly_ what you did that does not work for you: your original posting did not have lwd in the example. On Thu, 17 Feb 2005, Cézar Freitas wrote: Thank you so much, but the commands in par doesn't affect the pictures generated by postscript. For example, I put lwd=3, and the postscript file is the same, using par(lwd=3) or par(lwd=.5)... --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: I tested in R versions 1.8.1 and 2, but doesn't works. The attached plots can explain this. And mar isn't a parameter to postscript command. If I use in par, it doesn't affect the outpu. It does in R-2.0.1!!! Please try out what poeple are suggesting! You have to set par() for the current device, so after your call to postscript, as I have indicated below. Uwe Ligges Thanks, C. --- Uwe Ligges [EMAIL PROTECTED] escreveu: Cézar Freitas wrote: Hi all. I'm working with a short plot (3x3 inches), but the results (via postscript command) are not nice. The lwd command don't affect the lines (that are very large) and the margins don't change using oma, mai, mar, ... Below I put an example. Moreover, save the graphics via postscript command isn't working well (see the attached ps). Thanks by the help, Setting lwd=0.5 works for me, as well as using par(mar=c()) Cezar Freitas. #Example: #data scores-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0, 5.0, 2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0, 3.0, 3.0) q-summary(scores) gra-hist(scores, breaks=((0:11)/2-.2), plot=FALSE) yy-ceiling(max(gra$counts)/10)*10 yz-yy/12 #plot via postscript postscript(test.ps, width=3, height=3, horizontal=FALSE, family=Times, paper=special) par(mar=rep(1,4)+.1, lwd=0.5) hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6), ylim=c(-yz,yy), main=scores, ylab=Freq, xlab=math, cex.axis=.3, cex.main=.3, cex.sub=.3, cex.lab=.3, mgp=c(1.5,.5,0)) add lwd=0.5 Uwe Ligges boxplot(scores, horizontal=1, add=1, at=-2*yz/3, boxwex=1.5*yz, bty=n, axes=FALSE) points(q[4], -2*yz/3, col=1, pch=+, cex=.5) dev.off() -- Brian D. Ripley, [EMAIL PROTECTED] 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 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 ___ Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet rápida e grátis -- Brian D. Ripley, [EMAIL PROTECTED] 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 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!