[R] Basic: setting resolution and size of an R graphic

Marc Schwartz (via MN) mschwartz at mn.rr.com
Mon Oct 24 22:53:57 CEST 2005


On Mon, 2005-10-24 at 22:32 +0200, Dr. med. Peter Robinson wrote:
> Dear List,
> 
> I am sorry if this perhaps a too basic question, but I have not found an
> answer in Google or in the R help system. I am trying to use R to do a
> very simple analysis of some data (RT-PCR and Western analysis) with a
> T-test and
> to plot the results as a histogram with error bars. (I have pasted an
> example script at the bottom of this mail).
> In order to use this for publication, I would like to adjust the
> resolution and size of the final image. However, even using file types
> such as postscript or pdf that are vector based, I get rather bad-looking
> results with
> >pdf(file="test.pdf")
> >source("script at bottom of mail")
> >dev.off()
> 
> using either pdf or postscript or jpg devices.
> 
> 
> Therefore I would like to ask the list, how to best produce a graphic from
> the script below that would fit into one column of a published article and
> have a high resolution (as eps, or failing that tiff or png)?
> Thanks in advance for any advice,
> 
> Peter

<Snip of code>

What OS are you on?

Running your example on FC4, I get the attached output for a pdf().

I suspect that on your OS, the height and width arguments are not
appropriate by default.

Thus, you may need to adjust your pdf (or postscript) function call to
explicitly specify larger height and width arguments.

Also note that to generate an EPS file, pay attention to the details
section of ?postscript, taking note of the 'onefile', 'horizontal' and
'paper' arguments and settings.

Also, check with your journal to see if they specify dimensions for such
graphics so that you can abide by their specs if provided. If they are
using LaTeX, there are means of specifying and/or adjusting the height
and/or width specs in the code based upon proportions of various
measures (ie. \includegraphics[width=0.9\textwidth]{GraphicsFile.eps} ).

HTH,

Marc Schwartz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 5321 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20051024/fbf70820/test.pdf


More information about the R-help mailing list