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

Dr. med. Peter Robinson peter.robinson at charite.de
Tue Oct 25 08:57:43 CEST 2005


Thanks Marc and Jim for the tips. The PDF file that I create with R looks
about the same as the one you created. However, I need to get the graphic
to be a certain size (300 pixels wide). I have been using the ImageMagick
program to do so for other graphics:

convert test.pdf -resize 300x300 out.pdf

then out.pdf looks rather poor (pixelly). The original image is too big.
ANy ideas?
Thanks a lot,Peter


Am Mo, 24.10.2005, 22:53, schrieb Marc Schwartz (via MN):
> 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
>
>
>




More information about the R-help mailing list