[R] ps or pdf

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Mar 31 20:53:05 CEST 2008


On Mon, 31 Mar 2008, Francois Pepin wrote:

> Hi everyone,
>
> I have been making a fair amount of figures in R recently that I've
> been touching up with Illustrator and I've found a difference between
> pdf and ps files and I was wondering if someone could enlighten me
> about them.
>
> While the figures look the same, the ps version tends to have
> truncated strings. The last character of short strings tends to be on
> a string of its own, located right beside the rest. This makes it a bit
> awkward to manipulate, especially if scaling is involved. Is there a
> reason for this differences?

Please see the footer of this message.  Neither postscript() nor pdf() 
graphics devices split up strings they are passed (by e.g. text()), so 
this is being done either by the code used to create the plot (and we have 
no idea what that is) or by the viewer.  I suspect the problem is rather 
in the viewer, but without the example we asked for it is impossible to 
know.

> There also seems to be somewhat arbitrary grouping of the last column
> cells in heatmaps in ps files.

Again, we need an example.

> I used to prefer the ps because they embed more easily in latex
> documents (although pdf are not difficult and conversions are trivial
> anyhow), but I'm curious if there are other reasons why one format might
> be preferred over the other in this context.

The graphics devices are very similar (they share a lot of code).  One 
small difference is that PostScript has an arc primitive, and PDF does 
not.

> This is with R 2.6 on linux, and I've seen this behavior with older R
> version also.

Nothing has changed at that level for a long time -- not even in 
current versions of R (and 2.6.0 is obsolete).

>
> Francois
>
> sessionInfo()
> R version 2.6.0 (2007-10-03)
> x86_64-unknown-linux-gnu
>
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] rcompgen_0.1-15
>
> ______________________________________________
> 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.
>

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list