Hi- I have this small data set (this is from Glantz`s Biostatistics textbook, from the Hebbel et al. paper): 0 0 0 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 5 5 5 5 6 7 9 10 11 I wanted to produce a histogram+density plot, so I did this (BTW, I got this from the r-help archives, but it would be nice if someone included it some of the documents), after scanning the data set: histo <- hist(hebbel, xlim = range(dest$x), xlab = "x", ylab = "density", freq=FALSE)> dens <- lines(dest,lty=2)Then, I went on to save it as a .ps and an .eps file. As I understood in the R-intro.pdf:> postscript("/home/synthespian/r_graphics_test_plot.ps", horizontal=FALSE, height=5, pointsize=10) > postscript("/home/synthespian/r_graphics_test_plot.eps", horizontal=FALSE, height=5, pointsize=10)But this produced a file with 0 Kb (as loaded with xv)! And what are some good parameters - height and pointsize? Obviously, this is the way to go about it. How do I do it? TIA, Regs, HL PS: BTW, xlisp-stat has this _nice_ feature which is when you produce the graphic, you can just click on a widget so save it, change colors, etc. I wish this were present on R. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sun, 6 Jan 2002 hzi at uol.com.br wrote:> Hi- > > I have this small data set (this is from Glantz`s > Biostatistics textbook, from the Hebbel et al. paper): > > 0 0 0 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 5 5 5 5 6 7 9 10 11 > > I wanted to produce a histogram+density plot, so I did this > (BTW, I got this from the r-help archives, but it would be nice if > someone included it some of the documents), after scanning the data > set:(Eh? We try to put accurate information in the docs. This doe snot look right, and it is certainly incomplete.)> histo <- hist(hebbel, xlim = range(dest$x), xlab = "x", ylab = "density", freq=FALSE) > > dens <- lines(dest,lty=2)hebbel <- scan() 1: 0 0 0 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 5 5 5 5 6 7 9 10 11 34: Read 33 items hist(hebbel, prob = T, nclass = 11) rug(jitter(hebbel)) lines(density(hebbel, bw="SJ")) would do a reasonable job, but as this dataset is clearly not a continuous observation, it is not clear that a density plot is appropriate.> Then, I went on to save it as a .ps and an .eps file. As I > understood in the R-intro.pdf: > > > postscript("/home/synthespian/r_graphics_test_plot.ps", horizontal=FALSE, height=5, pointsize=10) > > postscript("/home/synthespian/r_graphics_test_plot.eps", horizontal=FALSE, height=5, pointsize=10)You need to set width too.> But this produced a file with 0 Kb (as loaded with xv)! > And what are some good parameters - height and pointsize? > Obviously, this is the way to go about it. > How do I do it?You need to plot on the device (so do this first), or use dev.copy2eps to make a copy. There is no difference in R between .ps and .eps plots.> TIA, > Regs, > HL > > PS: BTW, xlisp-stat has this _nice_ feature which is when you produce > the graphic, you can just click on a widget so save it, change colors, > etc. I wish this were present on R.It is on versions of R with a GUI: on the File menu under Windows, and I think also on the GNOME GUI. -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sun, Jan 06, 2002 at 12:45:22AM -0200, hzi at uol.com.br wrote: [...]> Then, I went on to save it as a .ps and an .eps file. As I > understood in the R-intro.pdf: > > > postscript("/home/synthespian/r_graphics_test_plot.ps", horizontal=FALSE, height=5, pointsize=10) > > postscript("/home/synthespian/r_graphics_test_plot.eps", horizontal=FALSE, height=5, pointsize=10) > > But this produced a file with 0 Kb (as loaded with xv)![...] Hi, you have to put: dev.off() after your plot statement.> And what are some good parameters - height and pointsize? > Obviously, this is the way to go about it.Try without any parameters but the filename. It depends on what you want to do with your ps-file. P.S You can scale ps-files _after_ the creation in size. -- Mit freundlichen Grüßen: +--------------------------------------------------------------+ | Peter Marx | | E-Mail: peter at beck-marx.de | Adresse: Hünenbergweg 2a | | Tel. : 07261/1 68 23 | 74889 Sinsheim | +--------------------------------------------------------------+ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sun, Jan 06, 2002 at 12:45:22AM -0200, hzi at uol.com.br wrote: additional suggestion: you have to open the postscript device first, and then the put your plot statement. And at the end comes the dev.off() -- Mit freundlichen Grüßen: +--------------------------------------------------------------+ | Peter Marx | | E-Mail: peter at beck-marx.de | Adresse: Hünenbergweg 2a | | Tel. : 07261/1 68 23 | 74889 Sinsheim | +--------------------------------------------------------------+ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._