Re: [R] postscript and histogram plots
On Sat, 11 Nov 2006, Robert Mintram wrote: The following code plots a little histogram perfectly well under X on It is not reproducible: please see the footer of this message. the screen but when I use the postscript command (also shown) to send this to a file I get an incomplete histogram. It seems to print only the first half of the bins. All headings and axes are OK. hist(d[,2],25,xlab=Calls,main=Customer Weekly Profile) # d[,2] is a data vector postscript(cust.eps,horizontal=FALSE) Any help would be greatly appreciated. Apparently you forgot dev.off(): since this is to a file, file-buffering will mean the file is incomplete until you close it. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Postscript fonts
On Sat, 5 Aug 2006, Erich Neuwirth wrote: How can I find out what fonts are available for par(family= for the postscript device? This is dynamic: for the current value names(postscriptFonts()) [1] serifsans mono [4] symbol AvantGarde Bookman [7] Courier HelveticaHelvetica-Narrow [10] NewCenturySchoolbook Palatino Times [13] URWGothicURWBookman NimbusMon [16] NimbusSanURWHelvetica NimbusSanCond [19] CenturySch URWPalladio NimbusRom [22] URWTimes ComputerModern ComputerModernItalic [25] Japan1 Japan1HeiMin Japan1GothicBBB [28] Japan1Ryumin Korea1 Korea1deb [31] CNS1 GB1 and for more details see the current R-News (6/2). -- 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Postscript fonts
Thanks, The following piece of code demonstrates a problem I still have. pdf(file=fonttest.pdf,fonts=c(Helvetica)) plot(1:10,main=,xlab=) par(family=Helvetica,font=1) title(main=Helvetica) par(family=Helvetica,font=2) title(sub=Helvetica-Bold) par(family=Helvetica,font=3) title(xlab=Helvetica-Oblique) dev.off() The font= parameter seems not to be respected. I do not get bold or italics. What am I doing wrong or not understand here? My original problem was that I had not understood that the fonts parameter is absolutely necessary when opening the device when one wants to use par(family= ). BTW, this is R 2.3.1 on Windows XP. Prof Brian Ripley wrote: On Sat, 5 Aug 2006, Erich Neuwirth wrote: How can I find out what fonts are available for par(family= for the postscript device? This is dynamic: for the current value names(postscriptFonts()) [1] serifsans mono [4] symbol AvantGarde Bookman [7] Courier HelveticaHelvetica-Narrow [10] NewCenturySchoolbook Palatino Times [13] URWGothicURWBookman NimbusMon [16] NimbusSanURWHelvetica NimbusSanCond [19] CenturySch URWPalladio NimbusRom [22] URWTimes ComputerModern ComputerModernItalic [25] Japan1 Japan1HeiMin Japan1GothicBBB [28] Japan1Ryumin Korea1 Korea1deb [31] CNS1 GB1 and for more details see the current R-News (6/2). -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Postscript fonts
How can I find out what fonts are available for par(family= for the postscript device? -- Erich Neuwirth, Didactic Center for Computer Science University of Vienna Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-9394 __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] postscript file too large : maybe an R question
Hi [EMAIL PROTECTED] wrote: i created a postscipt file in R and then i downloaded a free version of ghostview to view it. unfortunately, i get the message fata error : dynamic memory exhausted when i try to view it. when i do a dir on windows xp, the file size is 149,034,475 and i know there about 17,000 graphs. is there a way of possibly viewing this size postscript file in R itself ? This postscript file presumably has more than one page(?). Take a look at the 'onefile' argument in '?postscript'. Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ 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] postscript file too large : maybe an R question
i created a postscipt file in R and then i downloaded a free version of ghostview to view it. unfortunately, i get the message fata error : dynamic memory exhausted when i try to view it. when i do a dir on windows xp, the file size is 149,034,475 and i know there about 17,000 graphs. is there a way of possibly viewing this size postscript file in R itself ? Thanks __ 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] Postscript output encoding on Windows
With R 2.3.1 on Windows, I've noticed that it defaults to the WinAsci.enc encoding, which throws up an error when viewed with the default install of GhostScript/GSView (versions 8.51/4.7 respectively). I didn't have this problem prior to upgrading to 2.3.1 as I can view all my old PS graphs and they don't have the WinAsci encoding. I've got around this problem by adding encoding=CP1251.enc to the postscript call but it seems a little bizarre that the default WinAsci wasn't working. Any ideas what the problem might be? A problem with Ghostscript, a bug in R, or something strange about my installation (there shouldn't be)?? Should WinAsci be the default? Thanks, Jamie __ 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] Postscript output encoding on Windows
It is WinAnsi, not WinAsci, and that may well be your problem. Vanilla R 2.3.1 uses WinAnsi (I have just re-checked), so there is `something strange about my installation'. On Fri, 9 Jun 2006, Jamie Lawrence wrote: With R 2.3.1 on Windows, I've noticed that it defaults to the WinAsci.enc encoding, which throws up an error when viewed with the default install of GhostScript/GSView (versions 8.51/4.7 respectively). I didn't have this problem prior to upgrading to 2.3.1 as I can view all my old PS graphs and they don't have the WinAsci encoding. I've got around this problem by adding encoding=CP1251.enc to the postscript call but it seems a little bizarre that the default WinAsci wasn't working. Any ideas what the problem might be? A problem with Ghostscript, a bug in R, or something strange about my installation (there shouldn't be)?? Should WinAsci be the default? Thanks, Jamie __ 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 -- 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
[R] postscript bounding box in trellis/lattice plot is wrong ?
Hi, a problem involving postscript bounding boxes: I'm composing three scatterplots into a single figure, postsript for publication. The individual scatterplots should be square, so the overall figure should have a roughly 1:3 sort of aspect ratio. By default however, the overall figure comes out nearly square, and the scatterplots are stretched vertically. I fixed this by adding aspect=1/1 to the individual xyplot() calls. This produces a figure that looks correct. However, the bounding box for the figure leaves way too much space above and below... as if it is still assuming that the figure is square rather than 1:3 in proportions. Is there any fix for this? Thanks for any advice Here's the approximate code (very simple): library(lattice) plt_hi[[1]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) ... plt_hi[[2]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) ... plt_hi[[2]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) trellis.device(postscript, file=thefile, color=F) print(plt_hi[[1]], split=c(1,1,3,1), more=T) print(plt_hi[[2]], split=c(2,1,3,1), more=T) print(plt_hi[[3]], split=c(3,1,3,1), more=F) 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
Re: [R] postscript bounding box in trellis/lattice plot is wrong ?
On 3/1/06, context grey [EMAIL PROTECTED] wrote: Hi, a problem involving postscript bounding boxes: I'm composing three scatterplots into a single figure, postsript for publication. The individual scatterplots should be square, so the overall figure should have a roughly 1:3 sort of aspect ratio. By default however, the overall figure comes out nearly square, and the scatterplots are stretched vertically. I fixed this by adding aspect=1/1 to the individual xyplot() calls. This produces a figure that looks correct. However, the bounding box for the figure leaves way too much space above and below... as if it is still assuming that the figure is square rather than 1:3 in proportions. Is there any fix for this? Thanks for any advice Here's the approximate code (very simple): library(lattice) plt_hi[[1]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) ... plt_hi[[2]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) ... plt_hi[[2]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) trellis.device(postscript, file=thefile, color=F) For starters, you should heed the advice in ?postscript: The postscript produced for a single R plot is EPS (_Encapsulated PostScript_) compatible, and can be included into other documents, e.g., into LaTeX, using '\includegraphics{filename}'. For use in this way you will probably want to set 'horizontal = FALSE, onefile = FALSE, paper = special'. print(plt_hi[[1]], split=c(1,1,3,1), more=T) print(plt_hi[[2]], split=c(2,1,3,1), more=T) print(plt_hi[[3]], split=c(3,1,3,1), more=F) dev.off() Deepayan -- http://www.stat.wisc.edu/~deepayan/ __ 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] Postscript
Philippe Lamy wrote: Hi, I would like to create a multi-page postscript file. How can I do that in R ? Is it possible ? Yes, simply draw more than one plot. See ?postscript and its argument onefile, which already defaults to TRUE. Uwe Ligges Thanks for help. Philippe __ 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] postscript() filenames with forward slashes cause abort
My newly installed R-2.1.0 apparently doesn't like forward slashes in filenames: R.version.string [1] R version 2.1.0, 2005-04-18 plotfile - \home\mean_monthly_stl.eps postscript(plotfile) plotfile - /home/mean_monthly_stl.eps postscript(plotfile) *** glibc detected *** double free or corruption (!prev): 0x098e7180 *** Abort Does this have something to do with UTF-8 (about which I know little)? Scott Waichler Pacific Northwest National Laboratory [EMAIL PROTECTED] __ 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] postscript() filenames with forward slashes cause abort
Waichler, Scott R [EMAIL PROTECTED] writes: My newly installed R-2.1.0 apparently doesn't like forward slashes in filenames: R.version.string [1] R version 2.1.0, 2005-04-18 plotfile - \home\mean_monthly_stl.eps postscript(plotfile) plotfile - /home/mean_monthly_stl.eps postscript(plotfile) *** glibc detected *** double free or corruption (!prev): 0x098e7180 *** Abort Does this have something to do with UTF-8 (about which I know little)? I would conjecture that it has to do with the fact that you do not have write permission in /home! The backslashed version just creates homemean_monthly_stl.eps in the current directory. If you substitute /tmp for /home, the problem goes away (provided you're on some kind of Unix/Linux -- you didn't say). It's still a bug of course. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] postscript() filenames with forward slashes cause abort
My newly installed R-2.1.0 apparently doesn't like forward slashes in filenames: R.version.string [1] R version 2.1.0, 2005-04-18 plotfile - \home\mean_monthly_stl.eps postscript(plotfile) plotfile - /home/mean_monthly_stl.eps postscript(plotfile) *** glibc detected *** double free or corruption (!prev): 0x098e7180 *** Abort I would conjecture that it has to do with the fact that you do not have write permission in /home! The backslashed version just creates homemean_monthly_stl.eps in the current directory. If you substitute /tmp for /home, the problem goes away (provided you're on some kind of Unix/Linux -- you didn't say). It's still a bug of course. Yes, that was it. When I first came across the problem, I had a typo in my longish pathname. For the post to R Help I wanted to simplify the problem as much as possible, and as luck would have it, I picked a shorter pathname that was not writeable by me. Thanks, Scott __ 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] postscript (eps) / latex / par(mfg=...) / problem!
The same problem I am having has been reported here http://tolstoy.newcastle.edu.au/R/devel/04a/0344.html Namely that using par(mfg=...) with a postscript (eps) for inclusion with latex makes the figure appear upside down and back to front (flipped)! Converting the dvi to ps makes matters worse (the eps seems to be broken), however, it appears fine with gv. Here is (basically) the code I am using... dat - read.table(x.dmp, header=1) t(dat) t(dat) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CHAINS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 20 23 24 26 28 FREQUENCY 886 792 136 201 16 58 6 21 3 9 3 9 1 4 3 1 1 1 1 1 postscript( + x.eps, + width = 6.0, + height = 6.0, + horizontal = FALSE, + onefile = FALSE, + paper = special, + ) par(mfg=c(1,1)) par(mar=c(3,4,1,2)) plot(dat,type='b') par(mfg=c(2,1)) par(mar=c(4,4,0,2)) plot(dat,type='b', log='y') dev.off() Including the resulting file in a latex document like this... begin{figure} \centering \includegraphics[width=\textwidth]{x.eps} \caption[X] { Hello! } \label{xFig} \end{figure} The result is an upside down (flipped) version of my plot. I tried rotating 180 degrees (based on similar problems people were having on the list), but then it just gets worse (most of the plot is off the page). If I convert the dvi to ps (dvips -Ppdf my.tex.dvi -o my.tex.ps) it gets worse (a tiny speck where the image should be). After removing the two mfg commands (which I use to add grid lines (not shown for clarity)) everything is fine! Some how mfg is snarling things up. OK, I just had a brain wave (dont laugh). Here is a diff of the working eps vs the broken eps... diff broken working 78a79,80 %%Page: 1 1 bp 229c231 57.60 43.20 403.20 201.60 cl --- 57.60 57.60 403.20 216.00 cl 417c419 %%Pages: 0 --- %%Pages: 1 Does that help anyone debug my problem? Like I said, both look identical via gv, and are 'conceptually' identical in R. Here are my vitals Linux 2.4.20-31.9 i686 athlon i386 GNU/Linux R 2.0.0 (2004-10-04). GNU Ghostscript 7.05 (2002-04-22) Anything else you need? Please help! __ 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] postscript (eps) / latex / par(mfg=...) / problem!
Should I post this to 'bugs'? On Tue, 26 Apr 2005, Dan Bolser wrote: The same problem I am having has been reported here http://tolstoy.newcastle.edu.au/R/devel/04a/0344.html Namely that using par(mfg=...) with a postscript (eps) for inclusion with latex makes the figure appear upside down and back to front (flipped)! Converting the dvi to ps makes matters worse (the eps seems to be broken), however, it appears fine with gv. Here is (basically) the code I am using... dat - read.table(x.dmp, header=1) t(dat) t(dat) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CHAINS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 20 23 24 26 28 FREQUENCY 886 792 136 201 16 58 6 21 3 9 3 9 1 4 3 1 1 1 1 1 postscript( + x.eps, + width = 6.0, + height = 6.0, + horizontal = FALSE, + onefile = FALSE, + paper = special, + ) par(mfg=c(1,1)) par(mar=c(3,4,1,2)) plot(dat,type='b') par(mfg=c(2,1)) par(mar=c(4,4,0,2)) plot(dat,type='b', log='y') dev.off() Including the resulting file in a latex document like this... begin{figure} \centering \includegraphics[width=\textwidth]{x.eps} \caption[X] { Hello! } \label{xFig} \end{figure} The result is an upside down (flipped) version of my plot. I tried rotating 180 degrees (based on similar problems people were having on the list), but then it just gets worse (most of the plot is off the page). If I convert the dvi to ps (dvips -Ppdf my.tex.dvi -o my.tex.ps) it gets worse (a tiny speck where the image should be). After removing the two mfg commands (which I use to add grid lines (not shown for clarity)) everything is fine! Some how mfg is snarling things up. OK, I just had a brain wave (dont laugh). Here is a diff of the working eps vs the broken eps... diff broken working 78a79,80 %%Page: 1 1 bp 229c231 57.60 43.20 403.20 201.60 cl --- 57.60 57.60 403.20 216.00 cl 417c419 %%Pages: 0 --- %%Pages: 1 Does that help anyone debug my problem? Like I said, both look identical via gv, and are 'conceptually' identical in R. Here are my vitals Linux 2.4.20-31.9 i686 athlon i386 GNU/Linux R 2.0.0 (2004-10-04). GNU Ghostscript 7.05 (2002-04-22) Anything else you need? Please help! __ 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] PostScript scatter plot, losing points at RHS
I'm using the following sequence to plot a scatter plot to PostScript. Those familiar with the Iris LDA example in MASS will recognise what I'm at. postscript(hulda.eps, horizontal=FALSE, onefile=TRUE, height=6, width=6, pointsize=8, paper=special) plot(hu.ld, type = n, xlab= first linear discriminant, ylab=second linear discriminant ) text(hu.ld, labels = as.character(hu.species)) All fine except that, compared to the screen plot (apparently correct), 13 data points are missing on the right hand side. There is space for them, i.e. the plot is simply blank where they should be; and extending the height and width makes no difference. Version 1.9.0 (2004-04-12); running on Linux Fedora Core 2. TIA, Jon C. -- Jonathan G Campbell http://www.jgcampbell.com/ +44 (0)7974 663 262 __ 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] PostScript scatter plot, losing points at RHS
Jonathan Campbell wrote: I'm using the following sequence to plot a scatter plot to PostScript. Those familiar with the Iris LDA example in MASS will recognise what I'm at. No, I don't recognise: - Which edition of MASS? - I don't see hulda nor hu.ld. Really, do you expect us to read through the whole book again to search for some object called hu.ld??? - Which Chapter/Section? - Please specify a reproducible example, as the posting guide ask you to do. postscript(hulda.eps, horizontal=FALSE, onefile=TRUE, height=6, width=6, pointsize=8, paper=special) plot(hu.ld, type = n, xlab= first linear discriminant, ylab=second linear discriminant ) text(hu.ld, labels = as.character(hu.species)) All fine except that, compared to the screen plot (apparently correct), 13 data points are missing on the right hand side. Let me guess: Clipping occured and you may or may not want to rearrange spaces or set something like par(xpd=NA). There is space for them, i.e. the plot is simply blank where they should be; and extending the height and width makes no difference. Version 1.9.0 (2004-04-12); running on Linux Fedora Core 2. This version of R is really outdated these days. If my guess mentioned above is wrong, please try out R-2.1.0 beta and specify a reproducible example. Uwe Ligges TIA, Jon C. __ 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] PostScript scatter plot, losing points at RHS
On Apr 9, 2005 4:45 PM, Uwe Ligges [EMAIL PROTECTED] wrote: Jonathan Campbell wrote: I'm using the following sequence to plot a scatter plot to PostScript. Those familiar with the Iris LDA example in MASS will recognise what I'm at. No, I don't recognise: - Which edition of MASS? My two sentences above were largely irrelevant and the link with MASS (4th ed. p. 333) was quite oblique. Ignore them, as I would expect most people would. However, your suggestion of performing a replicatible experiment is useful and an exact replica of my problem occurs in it. From MASS 4th ed. page 304. data(iris3); ir - rbind(iris3[,,1], iris3[,,2], iris3[,,3]) ir.species - factor(c(rep(s, 50), rep(c, 50), rep(v, 50))) ir.pca - princomp(log(ir), cor = T) ir.pc - predict(ir.pca) plot(ir.pc[, 1:2], type = n, xlab = first principal component, ylab = second principal component) Apparently good plot (to screen). The 150 data points and three species appear to be there. Now to PostScript. postscript(irpca.eps, horizontal=FALSE, onefile=TRUE, height=6, width=6, pointsize=8, paper=special) plot(ir.pc[, 1:2], type = n, xlab = first principal component, ylab = second principal component) text(ir.pc[,1:2], labels = as.character(ir.species)) Problem. Only 21 s points shown -- over on left hand side of the plot. In my original problem also, the plot was limited 21 points. TIA, Jon C. -- Jonathan G Campbell http://www.jgcampbell.com/ +44 (0)7974 663 262 __ 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] PostScript scatter plot, losing points at RHS
Jonathan Campbell wrote: On Apr 9, 2005 4:45 PM, Uwe Ligges [EMAIL PROTECTED] wrote: Jonathan Campbell wrote: I'm using the following sequence to plot a scatter plot to PostScript. Those familiar with the Iris LDA example in MASS will recognise what I'm at. No, I don't recognise: - Which edition of MASS? My two sentences above were largely irrelevant and the link with MASS (4th ed. p. 333) was quite oblique. Ignore them, as I would expect most people would. However, your suggestion of performing a replicatible experiment is useful and an exact replica of my problem occurs in it. From MASS 4th ed. page 304. data(iris3); ir - rbind(iris3[,,1], iris3[,,2], iris3[,,3]) ir.species - factor(c(rep(s, 50), rep(c, 50), rep(v, 50))) ir.pca - princomp(log(ir), cor = T) ir.pc - predict(ir.pca) plot(ir.pc[, 1:2], type = n, xlab = first principal component, ylab = second principal component) You forgot text(ir.pc[,1:2], labels = as.character(ir.species)) Apparently good plot (to screen). The 150 data points and three species appear to be there. Now to PostScript. postscript(irpca.eps, horizontal=FALSE, onefile=TRUE, height=6, width=6, pointsize=8, paper=special) plot(ir.pc[, 1:2], type = n, xlab = first principal component, ylab = second principal component) text(ir.pc[,1:2], labels = as.character(ir.species)) You *really* forgot: dev.off() Everything fine for me, after using dev.off() ... Uwe Ligges Problem. Only 21 s points shown -- over on left hand side of the plot. In my original problem also, the plot was limited 21 points. TIA, Jon C. __ 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] PostScript scatter plot, losing points at RHS
Assuming you did dev.off() or quit the session at the end, I cannot reproduce this (even with 1.9.0). If you did, it is almost surely a faulty viewer (so check the actual file): if not you would have an incomplete plot since you failed to flush the output file buffer. On Sat, 9 Apr 2005, Jonathan Campbell wrote: On Apr 9, 2005 4:45 PM, Uwe Ligges [EMAIL PROTECTED] wrote: Jonathan Campbell wrote: I'm using the following sequence to plot a scatter plot to PostScript. Those familiar with the Iris LDA example in MASS will recognise what I'm at. No, I don't recognise: - Which edition of MASS? My two sentences above were largely irrelevant and the link with MASS (4th ed. p. 333) was quite oblique. Ignore them, as I would expect most people would. That plot works too. However, your suggestion of performing a replicatible experiment is useful and an exact replica of my problem occurs in it. From MASS 4th ed. page 304. data(iris3); ir - rbind(iris3[,,1], iris3[,,2], iris3[,,3]) ir.species - factor(c(rep(s, 50), rep(c, 50), rep(v, 50))) ir.pca - princomp(log(ir), cor = T) ir.pc - predict(ir.pca) plot(ir.pc[, 1:2], type = n, xlab = first principal component, ylab = second principal component) Apparently good plot (to screen). The 150 data points and three species appear to be there. Now to PostScript. postscript(irpca.eps, horizontal=FALSE, onefile=TRUE, height=6, width=6, pointsize=8, paper=special) plot(ir.pc[, 1:2], type = n, xlab = first principal component, ylab = second principal component) text(ir.pc[,1:2], labels = as.character(ir.species)) Problem. Only 21 s points shown -- over on left hand side of the plot. In my original problem also, the plot was limited 21 points. -- 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] PostScript scatter plot, losing points at RHS
On Apr 9, 2005 5:29 PM, Prof Brian Ripley [EMAIL PROTECTED] wrote: Assuming you did dev.off() Nope, I didn't. I assumed (not really thinking at all) that dev.off() was used merely to switch between display devices. And when I do, I get the complete plot! Very many thanks. And to Uwe too, especially for forcing the proper experiment. BTW, great software! And a great book (MASS). (I have wasted much of the last 33 years incompetently rolling my own versions of this stuff.) And not bad service either -- particularly for after 5.00pm on a Saturday afternoon :-) Thanks again, Jon C. -- Jonathan G Campbell http://www.jgcampbell.com/ +44 (0)7974 663 262 __ 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] postscript rotation (bug?)
hello, when making postscript images with postscript() and converting them to pdf with epstopdf, some images are rotated 90 degrees clockwise. The postscript displays fine (ggv). It seems to be related with length(xlab)/length(ylab), e.g: postscript(wrong.ps, width=5, height=5, horizontal=F, onefile=F, paper = special) plot(1, 1, xlab=short, ylab=abitlonger) dev.off() If then converted to pdf with epstopf, then wrong.pdf is rotated However, postscript(OK.ps, width=5, height=5, horizontal=F, onefile=F, paper = special) plot(1, 1, xlab=equal, ylab=equal) dev.off() en then converted to OK.pdf displays OK. Setting horizontal=T does not change anything for the final pdf file. (The .ps is rotated -90 degrees however). Is anyone able to reproduce this problem? I am using fedora core 3. Thanks, Wouter __ 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] postscript rotation (bug?)
On Mon, 2005-03-14 at 15:16 +, Wouter Buytaert wrote: hello, when making postscript images with postscript() and converting them to pdf with epstopdf, some images are rotated 90 degrees clockwise. The postscript displays fine (ggv). It seems to be related with length(xlab)/length(ylab), e.g: postscript(wrong.ps, width=5, height=5, horizontal=F, onefile=F, paper = special) plot(1, 1, xlab=short, ylab=abitlonger) dev.off() If then converted to pdf with epstopf, then wrong.pdf is rotated However, postscript(OK.ps, width=5, height=5, horizontal=F, onefile=F, paper = special) plot(1, 1, xlab=equal, ylab=equal) dev.off() en then converted to OK.pdf displays OK. Setting horizontal=T does not change anything for the final pdf file. (The .ps is rotated -90 degrees however). Is anyone able to reproduce this problem? I am using fedora core 3. There was just a discussion on this. See this thread: https://stat.ethz.ch/pipermail/r-help/2005-March/065593.html HTH, Marc Schwartz __ 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] postscript symbols?
On Tue, 1 Feb 2005, Marc Schwartz wrote: On Tue, 2005-02-01 at 18:48 -0800, [EMAIL PROTECTED] wrote: dear R wizards: is it possible to use a postscript font symbol as a plot symbol?in particular, I want to use the four postscript symbols for playing cards (club, heart, spade, diamond) as points. In LaTeX, these four are \Pisymbol{psy}{A7} \Pisymbol{psy}{A8} \Pisymbol{psy}{A9} \Pisymbol{psy}{A10} and what I would love to do is place them, at say, (x=1,y=1), (x=2,y=2), (x=3,y=3) and (x=4,y=4). Help appreciated---or merely a note that this is impossible. Font 5 is the symbol font, so plot(1:5, type=n) points(1:4, 1:4, pch=167:170, font=5) does this (not in that order, but you can make the mapping from that plot). -- 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] postscript symbols?
On Wed, 2005-02-02 at 09:57 +, Prof Brian Ripley wrote: On Tue, 1 Feb 2005, Marc Schwartz wrote: On Tue, 2005-02-01 at 18:48 -0800, [EMAIL PROTECTED] wrote: dear R wizards: is it possible to use a postscript font symbol as a plot symbol?in particular, I want to use the four postscript symbols for playing cards (club, heart, spade, diamond) as points. In LaTeX, these four are \Pisymbol{psy}{A7} \Pisymbol{psy}{A8} \Pisymbol{psy}{A9} \Pisymbol{psy}{A10} and what I would love to do is place them, at say, (x=1,y=1), (x=2,y=2), (x=3,y=3) and (x=4,y=4). Help appreciated---or merely a note that this is impossible. Font 5 is the symbol font, so plot(1:5, type=n) points(1:4, 1:4, pch=167:170, font=5) does this (not in that order, but you can make the mapping from that plot). That's definitely better. Can font=5 be added to ?par since it is not there presently in the details for 'font'. After seeing the above, I had a recollection of a prior post from Prof. Ripley on this, which I found here: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/32463.html The only other places I found it mentioned was in the announcement for R 0.49: http://finzi.psych.upenn.edu/R/Rhelpold/archive/0042.html and here: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/2358.html Thanks! Marc __ 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] postscript symbols?
A propos of these symbols, Henrik Bengtsson (Lund University, Sweden) posted to this list some time ago a very useful function ``plotSymbols'', which can be slightly modified as follows: plotSymbols - function (fn=1) { i - 0:255 ncol - 16 opar - par(cex.axis = 0.7, mar = c(3, 3, 3, 3) + 0.1) plot(i%%ncol, 1 + i%/%ncol, pch=i, font=fn, xlab = , ylab = , axes = FALSE) axis(1, at = 0:15) axis(2, at = 1:16, labels = 0:15 * 16, las = 2) axis(3, at = 0:15) axis(4, at = 1:16, labels = 0:15 * 16 + 15, las = 2) par(opar) } You can use this function to see what you get under various font specifications. Of course it would help to know a priori that font number 5 gave you the postscript symbols! cheers, Rolf Turner [EMAIL PROTECTED] __ 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] postscript symbols?
On Wed, 2005-02-02 at 10:03 -0400, Rolf Turner wrote: A propos of these symbols, Henrik Bengtsson (Lund University, Sweden) posted to this list some time ago a very useful function ``plotSymbols'', which can be slightly modified as follows: plotSymbols - function (fn=1) { i - 0:255 ncol - 16 opar - par(cex.axis = 0.7, mar = c(3, 3, 3, 3) + 0.1) plot(i%%ncol, 1 + i%/%ncol, pch=i, font=fn, xlab = , ylab = , axes = FALSE) axis(1, at = 0:15) axis(2, at = 1:16, labels = 0:15 * 16, las = 2) axis(3, at = 0:15) axis(4, at = 1:16, labels = 0:15 * 16 + 15, las = 2) par(opar) } You can use this function to see what you get under various font specifications. Of course it would help to know a priori that font number 5 gave you the postscript symbols! There is a similar function called TestChars in the examples in ?postscript, which I had actually reviewed last night before sending my initial reply using the Hershey vector fonts. However, you are correct, in that not knowing (or more correctly, not remembering) about font=5 caused a cerebral vapor lock... :-) Marc __ 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] postscript symbols?
dear R wizards: is it possible to use a postscript font symbol as a plot symbol?in particular, I want to use the four postscript symbols for playing cards (club, heart, spade, diamond) as points. In LaTeX, these four are \Pisymbol{psy}{A7} \Pisymbol{psy}{A8} \Pisymbol{psy}{A9} \Pisymbol{psy}{A10} and what I would love to do is place them, at say, (x=1,y=1), (x=2,y=2), (x=3,y=3) and (x=4,y=4). Help appreciated---or merely a note that this is impossible. regards, /iaw --- ivo welch __ 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] postscript symbols?
On Tue, 2005-02-01 at 18:48 -0800, [EMAIL PROTECTED] wrote: dear R wizards: is it possible to use a postscript font symbol as a plot symbol?in particular, I want to use the four postscript symbols for playing cards (club, heart, spade, diamond) as points. In LaTeX, these four are \Pisymbol{psy}{A7} \Pisymbol{psy}{A8} \Pisymbol{psy}{A9} \Pisymbol{psy}{A10} and what I would love to do is place them, at say, (x=1,y=1), (x=2,y=2), (x=3,y=3) and (x=4,y=4). Help appreciated---or merely a note that this is impossible. Ivo, This may not be exactly what you want, but... Using the Hershey vector fonts, you can plot (using text()) a variety of symbols. See ?Hershey and demo(Hershey) for more information. Here is an example: plot(0:5, 0:5, type = n) text(1:4, 1:4, vfont = c(sans serif, plain), labels = c(\\CL, \\DI, \\HE, \\SP), cex = 2) The set of escaped characters in the vector for the 'labels' argument are the codes for clubs, diamonds, hearts and spades, respectively. HTH, Marc Schwartz __ 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] postscript() and levelplot() in a for loop
Dear Thomas, It is very interesting to read FAQ 7.22. I don't see any example of lattice/trellis graphics linked with print() statement. How should I specify print()? Here are the actual codes I used to create the .ps file: x=y=myaa grid=expand.grid(x=x,y=y) postscript(paste(./Graphs/,file[k],.ps,sep=)) grid$z=as.vector(mymatrix) levelplot(z~x*y,grid,at=seq(0,1,by=0.01),scales=list(cex=2), colorkey=list(labels=list(cex=2,at=seq(0,1,by=0.2))), main=mytitle) dev.off() Thank you for any help. Yan -Original Message- From: Thomas Lumley [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 26, 2005 11:01 AM To: Wang, Yan Cc: R-help@stat.math.ethz.ch Subject: Re: [R] postscript() and levelplot() in a for loop On Wed, 26 Jan 2005, Wang, Yan wrote: Hi, I like to produce a series of levelplot graphs in postscript file, so I put the trunk of codes including postscript() and levelplot() in a for loop. The codes work fine outside the loop, but only produce empty .ps file when being put within the loop. Is it a problem associated with postscript() or levelplot()? How to get around the problem? Many thanks! It's hard to be sure without seeing any code, but it sounds like you should look at FAQ 7.22 Why do lattice/trellis graphics not work? -thomas __ 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] postscript plotting to 36 roll plotter
Hello, First, my thanks to the R developers; it is a wonderful tool and supports my development and production activities in many helpful ways. My problem is as follows: I want to make long (~ 20-30 feet) plots on a HP 755 (36 color roll plotter) using the R postscript command. I have tried paper=special with appropriate width and height, and everything seems ok from the postscript side. But the plot gets truncated to whatever -o PageSize I specify (which, of course, makes sense). But using -o w2592 (36 roll unlimited) truncates to letter. Enough words: here is what I am using now. postscript(|lpr -P hp755 -o PageSize=ARCHE, paper=special,width=ww,length=ll) This limits me to 48 inches (ARCHE=36*48). In summary, does anyone know the correct choice of parameters to get a roll plot without a predefined limit. I did set ps.options(paper)=default instead of letter and I am using R 1.8.1 on Linux. Thank you, Don p.s. I am not subscribed to this list, so cc'ing me would be appreciated. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] postscript device: horizontal=F
The postscript device behaves strangely - is this possibly a bug? case 1) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=F, onefile=FALSE); some plots here dev.off() The first plot is in portrait orientation The second and all the following plots are in landscape orientation case 2) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=T, onefile=FALSE); some plots here dev.off() Now, all plots are in portrait... So it seems that the orientation of the *first* plot is not affected by horizontal=T/F. Pascal __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postscript device: horizontal=F
Pascal A. Niklaus wrote: The postscript device behaves strangely - is this possibly a bug? case 1) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=F, onefile=FALSE); some plots here dev.off() The first plot is in portrait orientation The second and all the following plots are in landscape orientation case 2) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=T, onefile=FALSE); some plots here dev.off() Now, all plots are in portrait... So it seems that the orientation of the *first* plot is not affected by horizontal=T/F. Works for me (R-1.8.1alpha, WinNT4.0). Which version of R are you using? Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] postscript: font size in text(x,y,label)?
I would like to just create my (point) labels [created by text(x,y,labels)] in smaller font size, especially when I write out to eps. all other point sizes should not change. is this possible? help appreciated. regards, /iaw __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postscript: font size in text(x,y,label)?
On Wed, Nov 12, 2003 at 11:05:05AM -0500, ivo welch wrote: I would like to just create my (point) labels [created by text(x,y,labels)] in smaller font size, especially when I write out to eps. all other point sizes should not change. is this possible? help appreciated. regards, /iaw You didn't read help(text), did you? Anyway, works as advertised: plot(1:10) text(2,2,small,cex=0.5) text(4,4,big,cex=1.5) Hth, Dirk -- Those are my principles, and if you don't like them... well, I have others. -- Groucho Marx __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postscript: font size in text(x,y,label)?
Hi! I would like to just create my (point) labels [created by text(x,y,labels)] in smaller font size, especially when I write out to eps. all other point sizes should not change. is this possible? help I don't know how to define the point size exactly (since ps=something does not work in text()) but using the cex option is a workaround: plot(1:100, (1:100)^2) text(10,1000, foo) text(10,2000, foo, cex=2) cu Philipp -- Dr. Philipp PagelTel. +49-89-3187-3675 Institute for Bioinformatics / MIPS Fax. +49-89-3187-3585 GSF - National Research Center for Environment and Health Ingolstaedter Landstrasse 1 85764 Neuherberg, Germany __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] postscript device: pch='.' size?
hi ladies and gents: I am using R 1.7.0. Alas, the pch=. in the postscript device is too large for me, but apparently not scaleable via cex. Maybe a bug, though I read a complaing about this in the list archives from 1999, and given that it is still around, maybe it is a feature. Now, I would be happy with pch=o and cex=0.05, but for some strange reason, the resulting .eps file then becomes 3 times the size (200K, rather than 70K). For web-downloadable files, this can become painful. Are there any remedies? Regards, /iaw __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] postscript/eps label clipping
I guess I was wrong there. However it does seem that it will come down to fontsize 9 without clipping (or if it does I find it hard to see). -Original Message- From: Mulholland, Tom Sent: Friday, 11 July 2003 1:38 PM To: David Forrest; [EMAIL PROTECTED] Subject: RE: [R] postscript/eps label clipping Never having used postscript as an output method I looked to see what you were talking about. I noted that ps.options needs to be called before calling postscript. ps.options does have pointsize within it and silly though it may seem, its what I would do next. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] postscript/eps label clipping
On Fri, 11 Jul 2003, Mulholland, Tom wrote: I guess I was wrong there. However it does seem that it will come down to fontsize 9 without clipping (or if it does I find it hard to see). Thanks. It seemed like that is the way it was working, but it also seems counterintuitive: reduced pointsizes in postscript output make the graphs bigger, up to a point, after which the letters are too big(small?) to fit without clipping. Thanks again, Dave. -- Dave Forrest(434)924-3954w(111B) (804)642-0662h (804)695-2026p [EMAIL PROTECTED]http://mug.sys.virginia.edu/~drf5n/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] postscript/eps label clipping
The following code produces an eps file with the tops of each of the ylabs clipped off. par(mfrow=c(2,2)) plot(runif(10), ylab=Function(Lengthy Expression),xlab=Prediction) plot(runif(10), ylab=expression(Delta * Beta^2),xlab=Prediction) plot(runif(10), ylab=Function(Lengthy Expression),xlab=Prediction) plot(runif(10), ylab=expression(Delta * Beta^2),xlab=Prediction) dev.print(postscript,file=foo.eps, horizontal=FALSE,onefile=FALSE,paper=special, pointsize=7, width=5,height=4) ?postscript seems to indicate paper=special, width=, height=, and pointsize= are the recommended way to produce nice latex graphics. If I don't set a pointsize, the letters aren't clipped, but the graphs are tiny with respect to the x/y labels. Is there something else I should be adjusting instead? Thanks for your time, Dave -- Dave Forrest(434)924-3954w(111B) (804)642-0662h (804)695-2026p [EMAIL PROTECTED]http://mug.sys.virginia.edu/~drf5n/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] postscript/eps label clipping
Never having used postscript as an output method I looked to see what you were talking about. I noted that ps.options needs to be called before calling postscript. ps.options does have pointsize within it and silly though it may seem, its what I would do next. _ Tom Mulholland Senior Policy Officer WA Country Health Service 189 Royal St, East Perth, WA, 6004 Tel: (08) 9222 4062 e-mail: [EMAIL PROTECTED] The contents of this e-mail transmission are confidential and may be protected by professional privilege. The contents are intended only for the named recipients of this e-mail. If you are not the intended recipient, you are hereby notified that any use, reproduction, disclosure or distribution of the information contained in this e-mail is prohibited. Please notify the sender immediately. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 11 July 2003 1:17 PM To: [EMAIL PROTECTED] Subject: [R] postscript/eps label clipping The following code produces an eps file with the tops of each of the ylabs clipped off. par(mfrow=c(2,2)) plot(runif(10), ylab=Function(Lengthy Expression),xlab=Prediction) plot(runif(10), ylab=expression(Delta * Beta^2),xlab=Prediction) plot(runif(10), ylab=Function(Lengthy Expression),xlab=Prediction) plot(runif(10), ylab=expression(Delta * Beta^2),xlab=Prediction) dev.print(postscript,file=foo.eps, horizontal=FALSE,onefile=FALSE,paper=special, pointsize=7, width=5,height=4) ?postscript seems to indicate paper=special, width=, height=, and pointsize= are the recommended way to produce nice latex graphics. If I don't set a pointsize, the letters aren't clipped, but the graphs are tiny with respect to the x/y labels. Is there something else I should be adjusting instead? Thanks for your time, Dave -- Dave Forrest(434)924-3954w(111B) (804)642-0662h (804)695-2026p [EMAIL PROTECTED]http://mug.sys.virginia.edu/~drf5n/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] 'postscript' command within a function
Edoardo, I'm wondering why postscript(file=filename) doesn't suffice, and you need to use eval instead? Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia [EMAIL PROTECTED] Quoting Edoardo Airoldi [EMAIL PROTECTED]: hello all, I am trying to print a ps file as part of a function as in: func - function (..., filename=temp.ps) { # some stuff [...] # plot eval( cat(postscript(\,filename,\)\n, sep=) ) plot(...) abline(...) dev.off() # more stuff [...] } but it does not work. Nor it does with 'paste' instead of 'cat'. In order to make it work I have to call: postscript(temp.ps) func(...) dev.off() I am wondering why is that? How can I make my call to postscript within a function sort of 'global' ?? thanks Edo __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Postscript query: plotting long vectors
Hi, I have a query about the maximum length of vector that can be plotted in one go in a postscript driver. Try the following code (in 1.7.0; version details below): t - seq(from=0, to=4*pi, length=20) y - sin(t) postscript(file=o.ps) plot(t, y, type=l) dev.off() If I view the postscript file o.ps in gv, it takes many seconds before eventually the axes appear, but then only one vertical line is drawn within the plot area -- there is no sine curve. (this is on a fast dual processor linux machine with 2Gb RAM.) This is clearly a postscript problem, rather than a R problem, since reducing the length of t down to something like 2000 solves the problem. By looking at the file o.ps it looks like the line is drawn by one rlineto call per point, followed eventually by a stroke after the last point. I'm guessing that the postscript interpreter simply cannot remember so many points in the path before it gets to the stroke. The example above is artificial, but this problem appeared with a real data set this morning. The fix was to replace the single call to plot() with many calls to line(), breaking the t and y vectors into more manageable chunks; in this way, each postscript path was manageable and we got the plot. I tried plotting the same long vectors in gnuplot by first writing them from R: write.table(cbind(t,y), sep=\t, file=eg.dat, row.names=F, col.names=F, quote=F) and then in gnuplot: set term postscript set output gnuplot.ps plot eg.dat wi lines This came out fine; in gnuplot.ps every 400 lines during the plot it outputs currentpoint stroke M (M is defined to moveto). I had a look at the gnuplot source (gnuplot-3.7.3/term/post.trm) and found that it does keep count of the length of the current postscript path: e.g. in the function PS_vector(x,y) we see (line 1122): if (ps_path_count = 400) { fprintf(gpoutfile,currentpoint stroke M\n); ps_path_count = 0; } so every 400 points it draws the line so far and then continues. (Matlab .ps files also seem to have regular MP stroke. I had a quick look in the corresponding R code src/main/devPS.c and could not see any counter. Would it be worth adding such a counter and periodic line output to PS_Polyline? version platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor7.0 year 2003 month04 day 16 language R __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Postscript query: plotting long vectors
On 29-May-03 Stephen Eglen wrote: t - seq(from=0, to=4*pi, length=20) y - sin(t) postscript(file=o.ps) plot(t, y, type=l) dev.off() If I view the postscript file o.ps in gv, it takes many seconds before eventually the axes appear, but then only one vertical line is drawn within the plot area -- there is no sine curve. (this is on a fast dual processor linux machine with 2Gb RAM.) This is clearly a postscript problem, rather than a R problem, since reducing the length of t down to something like 2000 solves the problem. By looking at the file o.ps it looks like the line is drawn by one rlineto call per point, followed eventually by a stroke after the last point. I'm guessing that the postscript interpreter simply cannot remember so many points in the path before it gets to the stroke. Absolutely no problem here: beautiful sine curve, axes and all (gv-3.5.8 of June 1997, R-1.6.2, medium-speed 733MHz single processor with 512MB RAM running Linux; 15 seconds to draw the curve; 'gs' 5.5 took about 5 secs). At a guess your 'gv' is not coping. It's not a PS problem as such. Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 29-May-03 Time: 19:00:38 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Postscript PBs
Hi, I use R 1.6.2 under Mandrake9.0. I've got a problem with the postscript files I try to creat. When I look to the file with ghostview it's ok. When I want to print it, I've got a blank page or a black page (fill of black encre) I changed the printer (guessing it was my driver printer), it was the same. Does anyone had the same problem and resolved it ? -- Cordialy Emmanuel POIZOT Cnam/Intechmer Digue de Collignon 50110 Tourlaville Tél : (33)(0)2 33 88 73 42 Fax : (33)(0)2 33 88 73 39 - __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] postscript problems
I am using R-1.6.1 and when I save a figure using dev.print(file=figure.eps) and then insert this figure into a LaTeX file (using \includegraphics and the package graphicx) , the figure obscures some nearby text (it gets blanked out by white). Comparing the postscript file to that produced by an earlier version of R I can see the extra lines marked with a star below: %%Page: 1 1 bp /bg { 1. 1. 1. } def * 0.00 0.00 841.89 595.28 r p2 * 204.83 90.14 318.71 513.85 cl * 204.83 90.14 318.71 513.85 cl If I remove these 3 lines by hand the problem disappears, but surely there is an easier way!? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] postscript and ps.option metrics
Good Afternoon All, I am working on a project to generate a particular celeration graph that requires a very specific height and width in the format of the postscript output. I have attempted to specify my height and width parameters in inches as I found in the R help documentation, but this produces a graph much smaller than what it should if the standard metric is indeed inches. Since inches do not work, I've tried to eyeball the metric by printing out different iterations of the height and width parameters and overlaying a copy of the graph I need on it. This is very time consuming (which I don't mind), inefficient (which I do mind), and tedious (which I do mind) as the width axis (X axis in landscape format) doesn't seem to be moving as the parameter decreases in iterations. If someone has a few minutes, could you review the code snippet below and provide any suggestions about possible revisions/additions to this? I've looked at it so long I can't tell what might be glaringly wrong or missing. Many Thanks, Patrick McLeod University of North Texas Denton, TX. P.S. The specific axis measurements (in inches) should be: height=5.4, width=8.1 in a landscape format. # TODO: #win.graph(width=8.6,height=11.5) postscript(C:/Data/.ps, width = 11.6, height = 7.5, horizontal = TRUE, onefile = TRUE, paper = letter, family = ComputerModern) # Import Sample Data: Movies IMDB) movies - read.table('x', header=T, row.names=NULL) attach(movies) # cases - read.table('x', header=T, row.names=NULL) # attach(cases) # Set up the chart yticks - c(1,2,3,4,5,6,7,8,9, 10,20,30,40,50,60,70,80,90, 100,200,300,400,500,600,700,800,900, 1000,2000,3000,4000,5000,6000,7000,8000,9000, 1,2,3,4,5,6,7,8,9, 10,20,30,40,50,60,70,80,90,100) myticks - c(1,10,100,1000,1,10,100) mylabs - c(1,10,100,1,000,10,000,100,000, 1,000,000) mnyticks - c(5,50,500,5000,5,50) mnylabs - c(5,50,500,5,000,50,000,500,000) xticks - c(1:100) #mxticks - c(0,10,20,30,40,50,60,70,80,90,100) periods - c(1900,1905,1910,1915,1920,1925,1930,1935,1940,1945,1950,1955,1960,1965,1970,1975,1980,1985,1990,1995,2000) mxticks - c(1900,1910,1920,1930,1940,1950,1960,1970,1980,1990,2000) mnxticks - c(1905,1915,1925,1935,1945,1955,1965,1975,1985,1995) mxlabs - c(0,10,20,30,40,50,60,70,80,90,100) plot(Year,Movies,ylim=c(1,100),xlim=c(1902,2002),log='y',type='o',axes=F) axis(side=2, at=myticks, las=2, labels=mylabs, pos=1900, tck=-0.02) axis(side=2, at=myticks, pos=1900, tck=.95, labels=F) axis(side=2, at=yticks, labels=F, pos=1900, tck=0.01) axis(side=2, at=yticks, labels=F, pos=1900, tck=0.93) axis(side=2, at=mnyticks, las=2, labels=mnylabs, pos=1900, tck=-0.015, cex=.5) axis(side=2, at=mnyticks, las=2, labels=F, pos=1900, tck=0.93, cex=.5) axis(side=1, at=mxticks, pos=1, labels=mxlabs, tck=-0.02) axis(side=1, at=c(1900:2000), pos=1, labels=F,tck=-0.01) axis(side=1, at=mnxticks,pos=1, tck=.01, labels=F) axis(side=1, at=periods, pos=1, tck=.93, labels=F) axis(side=3, at=mxticks, pos=100) axis(side=4,pos=2000,labels=F,tck=0) dev.off() __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postscript: can't center plot
Deborah, Perhaps, a good idea is to use eps output to include it into a LaTeX document, in this manner you can format and layout your graphics exactly the way you want. If you need more information, I'm ready for your disposal. -Serge __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Postscript linewidth errors
Nothing in Rbugs or Rhelp on this that I could see: [Redhat 7.3 (Intel); R 1.6.2] R Postscript output contains a bunch of the following commands: nan setlinewidth And GNU Ghostscript 6.52 chokes with: Error: /undefined in nan Operand stack: ... The figure is a fairly complex directed graph with varying linewidths. I am able to write the figure to the x11 and xfig devices just fine from within R, and even export to EPS from xfig with no problems. So it seems like a bug in the R postscript driver. Anyone else see this? -- __ Neil E. Klepeis, UC Berkeley, School of Public Health, Berkeley, CA USA. --- The most beautiful thing we can experience is the mysterious. It is the source of all true art and science. --Einstein __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] postscript: can't center plot
One of our color postscript printers needs a slightly larger margin than the default, so I'm trying to send slightly smaller graphics to it, but all the extra margin I provide ends up at the right and bottom of the page. These are the relevant (I imagine) ps.options: $paper [1] special $width [1] 10 $height [1] 8 $pagecentre [1] TRUE I tried this on two systems, in two versions of R, and the output is identical. linux: R 1.6.1 (2002-11-01) mips-sgi-irix6.5: R 1.6.1 Beta (2002-10-28) I'll attach a postscript file, which is very simple but I think shows the asymmetry I'm talking about. I'll file a bug report if I should, but I thought I'd give y'all a chance to confirm the behavior or tell me I'm going about this all wrong. Debby lestat.ps Description: PostScript document