Dear colleagues, Saving a plot with pdf gives a very nice result: pdf("myplot.pdf") par(font=1,family='serif') plot(pressure) dev.off() Doing the very same with other formats (png, jpeg, tiff) gives far worse results. Is there anything to do to make a plot in some other format than pdf look like the pdf? Hardly any journal accepts pdf files for figures, and most do accept png and jpeg -- so no matter what I think about this, I must follow this rule. What can I do, then? I am using R 2.9.0 for Windows XP. Many thanks in advance, Wolf
Hi, postscript should do, "*.eps" specifically. x=rnorm(100,0,1) e=rnorm(100,0,1) y=x+e postscript("myeps.eps") plot(y~x) dev.off() Cheers, Daniel ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im Auftrag von Stats Wolf Gesendet: Thursday, May 14, 2009 12:47 AM An: r-help at r-project.org Betreff: [R] Graphical output format Dear colleagues, Saving a plot with pdf gives a very nice result: pdf("myplot.pdf") par(font=1,family='serif') plot(pressure) dev.off() Doing the very same with other formats (png, jpeg, tiff) gives far worse results. Is there anything to do to make a plot in some other format than pdf look like the pdf? Hardly any journal accepts pdf files for figures, and most do accept png and jpeg -- so no matter what I think about this, I must follow this rule. What can I do, then? I am using R 2.9.0 for Windows XP. Many thanks in advance, Wolf ______________________________________________ R-help at r-project.org 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.
Stats Wolf <stats.wolf <at> gmail.com> writes:> > Saving a plot with pdf gives a very nice result: > > pdf("myplot.pdf") > par(font=1,family='serif') > plot(pressure) > dev.off() > > Doing the very same with other formats (png, jpeg, tiff) gives far > worse results. Is there anything to do to make a plot in some other > format than pdf look like the pdf? Hardly any journal accepts pdf > files for figures, and most do accept png and jpeg -- so no matter > what I think about this, I must follow this rule. What can I do, then?Either create the graphs with very large width and height (usually corresponding to 600dpi); scaling may be tricky if you use this way, check the pointsize parameter. Or, my preferred way: create pdf, and use Ghostview to make the conversion. There is nice utility called GhostFriend that helps in getting the horrible parameters right and processing whole directories. Dieter
Thank you, Paul. Postscript, however, does not have to be what I need for two reasons. First, it does not accept some special characters from foreign languages (exactly like PDF). Second, not too many journals accept it. So from your -- and Daniel's -- reply I understand other formats will not work well? (Byt bad I understand the quality of the images, which is perfectly seen on fonts). Thanks, Wolf On Thu, May 14, 2009 at 7:15 AM, Paul Johnson <pauljohn32 at gmail.com> wrote:> You don't say what is bad about the other formats, but I can imagine. > There is a png issue in Linux we were complalaining about a while ago. > > Journals will take postscript in my experience. ?Try these options > > postscript("file.eps", height=6, width=6, onefile=F, horizontal=F, > paper="special") > > The onefile is needed to get a bouning box. > > you might try adding the paper option to your pdf command because it > eliminates that huge margin on top of the output > > pj > > On Wed, May 13, 2009 at 11:47 PM, Stats Wolf <stats.wolf at gmail.com> wrote: >> Dear colleagues, >> >> Saving a plot with pdf gives a very nice result: >> >> pdf("myplot.pdf") >> par(font=1,family='serif') >> plot(pressure) >> dev.off() >> >> Doing the very same with other formats (png, jpeg, tiff) gives far >> worse results. Is there anything to do to make a plot in some other >> format than pdf look like the pdf? Hardly any journal accepts pdf >> files for figures, and most do accept png and jpeg -- so no matter >> what I think about this, I must follow this rule. What can I do, then? >> >> I am using R 2.9.0 for Windows XP. >> >> Many thanks in advance, >> Wolf >> >> ______________________________________________ >> R-help at r-project.org 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. >> > > > > -- > Paul E. Johnson > Professor, Political Science > 1541 Lilac Lane, Room 504 > University of Kansas >-- Stats Wolf
Stats Wolf wrote:> Dear colleagues, > > Saving a plot with pdf gives a very nice result: > > pdf("myplot.pdf") > par(font=1,family='serif') > plot(pressure) > dev.off() > > Doing the very same with other formats (png, jpeg, tiff) gives far > worse results. Is there anything to do to make a plot in some other > format than pdf look like the pdf? Hardly any journal accepts pdf > files for figures, and most do accept png and jpeg -- so no matter > what I think about this, I must follow this rule. What can I do, then?What journals are you looking at? I see the opposite in medicine, epidemiology, and biostatistics, with the majority of journals requesting pdf or eps (which can easily be created by R or by running a simple conversion from pdf). Frank> > I am using R 2.9.0 for Windows XP. > > Many thanks in advance, > Wolf >-- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
Stats Wolf <stats.wolf <at> gmail.com> writes:> Postscript, however, does not have to be what I need for two reasons. > First, it does not accept some special characters from foreign > languages (exactly like PDF).You should given an example for that in pdf. I always had the impression that pdf is the most comprehensive in foreign character support. Dieter