Sunday, August 18, 2013

Graphing with R and Adobe Illustrator


R is a great resource for making graphs, but it is still limited in its ability to fine-tune and format figures.  Adobe Illustrator complements R by providing an incredible amount of tools for figure formatting and fine-tuning.  Using these programs together is a great way to make quality graphs, so I want to make some notes on using R graphs in Illustrator (CS6).
First the graphs need to be generated in R.  I have been using {ggplot2} to generate my graphs, although the R {graphics} package works too.  Once a graph is made in R, it needs to be saved as a pdf and opened in Illustrator.



Open the R pdf in Illustrator and 'select all'.  From here release the clipping masks by going to Object > Clipping Mask > Release.  Once this is done you will be able to modify any aspect of your figure, from text fonts to bar graph colors.  For more information, please check out the paper by Scherber, C in the works cited.

One minor problem I ran into was copying the imported R figure and pasting it into a larger workspace so that I could combine figures:


It turns out the imported R figure had a piece that extended down from the bottom left corner, and to the right from the top right corner.  Deleting this part of the figure allows it to be pasted into other work spaces.

Works Cited



No comments:

Post a Comment