R/Publication Plots
(created page) |
(→Shading Regions on Plots: formatting for code) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 23: | Line 23: | ||
== Color == | == Color == | ||
See [[R/Colors]]. | See [[R/Colors]]. | ||
+ | |||
+ | == Shading Regions on Plots == | ||
+ | * [http://www.alisonsinclair.ca/2011/03/shading-between-curves-in-r/ Here] are some nice examples using the <code>polygon</code> function. | ||
== Text == | == Text == | ||
− | * <code>mtext()</code> for doing your own axis labeling | + | * <code>mtext()</code> for doing your own axis labeling (you can use <code>las</code> to control the orientation, i.e. horizontal vs. vertical) |
*[[R/Adding_letters | Adding letters to panels]] | *[[R/Adding_letters | Adding letters to panels]] | ||
+ | * A nice overview of [http://www.statmethods.net/advgraphs/axes.html Axes & Text] | ||
Latest revision as of 19:57, 3 July 2012
Some tips for creating plots for publication
Contents |
Format
Check with the journal to see if they have file format requirements. You want to use a vector format not a raster format (i.e. pdf not jpg). Your figures will be more reproducible if you use the pdf()
and dev.off()
commands rather than saving the plot window output.
Size
If possible, check the journal for the size options for figures (i.e 1 column width, full page width, etc.). Use those sizes when you create you figure, so it won't need to be reduced/enlarged. This will almost definitely mean using a smaller cex value than 1. Something like the following will change the baseline cex, but just for that figure:
pdf(file = "figure1.pdf", width = 3, height = 3) par(cex = 0.7) ... dev.off()
Margins
Adjust margins so that you don't have a lot of unused white space. This is especially important for multi-panel plots, but if you adjust the margins per panel, make sure that the left/right and top/bottom add up in such a way that the aspect ratio is the same.
Margins can be adjusted using 2 par()
settings:
- mar - specifies the margins in number of lines
- mai - specifies the margins in inches
You can also specify which line (including fractional lines) axis elements like ticks, tick labels and axis labels are placed on with the par()
setting mgp
. You can shorten the tick lines with tck
. For example,
par(mar = c(3, 3, 0, 0) + 0.1, mgp = c(1.5, 0.5, 0), tck = -0.03 )
Color
See R/Colors.
Shading Regions on Plots
- Here are some nice examples using the
polygon
function.
Text
-
mtext()
for doing your own axis labeling (you can uselas
to control the orientation, i.e. horizontal vs. vertical) - Adding letters to panels
- A nice overview of Axes & Text