•home •dogfish •R code• other interests •contact
For some reason this page appears very high on google searches that I would have hoped would lead to more useful places. If you were looking for something more general or more complete, try the R Graphics page by Paul Murrell or the R Graph Gallery.
This page is a place to share code for a few plots I've made using the statistics software R. It is also the first webpage I've ever made using Adobe GoLive, so it may be a bit shoddy.
Jump to code for:
An attempt to make trellis-like plots without having to use the lattice package. Apparently the trellis function can't make plots where the cells are arranged in order by column rather than row, or at least I couldn't figure out how to do it. Thanks go to Ian Stewart for the inspiration to figure this out.
Here's an example plot and the associated layout made using the layout command. The file giving_up_on_trellis.r contains the code used to generate these two plots.

Since I'm making all my other plots in R, it's useful to be able to make maps there as well. Here are two examples made using the code in Rmap.r with the color regions specified in Rmap_boundaries.r. The fade in the first map was made using the GNU Image Manipulation Program (GIMP).


I'm sure for the GIS expert, depth contours require just a few commands. Here's my attempt to do it in R using data from http://www.ngdc.noaa.gov/mgg/gdas/gd_designagrid.html. The R code is in depthContours.r and the associated data file is zipped here: ETOPO2_NEpacific.zip (1.6 MB).

The plots given by demo(persp) are impressive. I've attempted to make a function (persp2.r) which includes as defaults some of the shading, the gray walls, and the interpolation of color values that are found in that demo. Here's an attempt to use it to illustrate proportions at age including the growth morphs available in Rick Methot's Stock Synthesis 2 modeling platform.

