[R-sig-eco] Publication quality graphics in R

Brian Knaus knausb at science.oregonstate.edu
Sat May 31 01:04:43 CEST 2008


Hi Mark,

as previous people have stated ps and png are good options.  Another  
option is the tiff format.  In the past you had to install the Cairo  
package and use function Cairo().  As of R 2.7.0 there is now the  
function tiff() to create tiffs, it looks like the Cairo functions  
have become part of R.  Either way you need to install Cairo  
separately outside of R.  Also expect to get some interesting  
formatting issues when you create high res (300 dpi) graphics (e.g.,  
you need to scale text including axes appropriately, see: ?par).  A  
nice feature is that you can specify the graphic size in inches so use  
~7 in wide for full page or ~3.5 in wide for single column (check your  
journal's style guide).  Note that there will be some interesting  
artifacts due to your screen probably being 72 dpi, print out a copy  
before you submit it to make sure the print version looks like what  
you want (a 300 dpi image looks huge on my monitor).

I've been putting R graphics on my website to keep my committee  
informed.  If you'd like to see some examples see (everything except  
the map on the webpage is R output):

http://oregonstate.edu/~knausb/pubs/asle_aflp/asle_aflp.html

The downside of tiff is that they're big, the good side is that you  
can edit the tiff in your favorite graphics package (e.g., the GIMP).

Enjoy!

-- 
Brian J. Knaus
Ph.D. Candidate
Department of Botany and Plant Pathology
Oregon State University
2082 Cordley Hall
Corvallis, OR 97331-2902
http://oregonstate.edu/~knausb


Quoting Krzysztof Sakrejda-Leavitt <krzysztof.sakrejda at gmail.com>:

> Hi Mark,
>
> I second writing to files as David says, but I have a few things to add:
>
> - jpg is meant to encode photos, and because of the compression it uses
> it will butcher complicated text, especially if you have to re-save
> multiple times, resize the images, etc...  PNG avoids this problem but
> still compresses photo-like images nicely (say colored 3-D plots).  MS
> Office will definitely accept PNG.
>
> - postscript is probably best for simpler figures (I think MS Office
> accepts it happily) and journals should be happy to take it (?)
>
> - when you open the PNG/pdf/postscript device for writing an image, it
> helps to already know what size/resolution the image needs to be
> because resizing will almost certainly alter the look of text. I tend
> to save data frames for making particular figures instead of saving
> images for this reason.
>
> - I haven't had trouble with this, but the ?postscript help page
> mentions that if you use complex symbols, you need to make sure you
> have good fonts/encodings set for them--see the encodings section on
> ?postscript...
>
> - The R wiki has some good information on preparing images.
>
> Hope that helps,
>
> Krzysztof
>
>
>
> Mark A. Albins wrote:
>> R-sig-eco list,
>>
>> This is a bit of a tangent from the current conversation, but can   
>> someone elaborate on
>> this quote from the following message,
>>
>> "Plots in R come out so nicely, publication quality if you specify   
>> them correctly."
>>
>> In particular, I'd like to hear from the list, how folks specify   
>> and export presentation
>> quality and publication quality graphics with R.  I've had problems  
>>  when exporting
>> graphics using the copy-to-clipboard option (both bitmap and   
>> metafile) and also when
>> saving them as jpgs.  They almost always seem to look a little   
>> funny (e.g. pixelation,
>> symbols coming out distorted etc.).  The only option that I've had   
>> much success with is
>> saving them as pdf's, but that format is less than ideal when   
>> trying to incorporate a
>> graphic into another document (e.g. Word or Powerpoint), and is   
>> often not the format
>> requested by journals.
>>
>> Any advice would be appreciated.
>>
>> Thanks,
>>
>> Mark
>>
>> __________________________________________________
>>
>> Message: 1
>> Date: Thu, 29 May 2008 20:21:54 -0400
>> From: Jessi Brown <jlbrown at unr.edu>
>> Subject: [R-sig-eco] AIC, R-Mark, and nest survival
>> To: r-sig-ecology at r-project.org
>> Message-ID: <483F48A2.9040906 at unr.edu>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Hi, Dave. Thanks for pointing out the merits of R-Mark as far as
>> generating AIC tables reflecting the results of nest survival and other
>> data model types.
>>
>> I do indeed use R-Mark for CJS and multistate population modeling, but I
>> prefer the logistic exposure/"Shaffer" nest modeling paradigm for a
>> number of reasons. When you have something of a background in linear
>> models, the GLM approach is perhaps a little more intuitive than Program
>> MARK (but R-Mark circumvents some of that), and data preparation and
>> covariate handling seems to go more quickly and easily. Plots in R come
>> out so nicely, publication quality if you specify them correctly. Also,
>> there's capacity for extending the logistic-exposure models to mixed
>> models (which might not be a wise decision, based on violation of the
>> assumption that the mean of the error distribution is equal to zero, but
>> I digress).
>>
>> I've done nest survival with both Program MARK (not R-Mark) and GLMs in
>> R, and it seems to me (not a biostatistician, but an ecologist who
>> dabbles with statistical tools), that it's ok to just go with whatever
>> suits your particular style. In my case, since I tend to start with (and
>> retain) fairly focused, restricted model suites, it doesn't bother me
>> much to hand construct AIC tables with the "n-effective" calculated AIC
>> values after having run the GLMs.
>>
>> BTW, if anyone needs a script of how to set up the logistic-exposure
>> link function, it's among the examples in help(family).
>>
>> cheers, Jessi Brown
>>
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



More information about the R-sig-ecology mailing list