Streamlined Plot Theme and Plot Annotations for 'ggplot2'

Some helpful extensions and modifications to the 'ggplot2' package. In particular, this package makes it easy to combine multiple 'ggplot2' plots into one and label them with letters, e.g. A, B, C, etc., as is often required for scientific publications. The package also provides a streamlined and clean theme that is used in the Wilke lab, hence the package name, which stands for Claus O. Wilke's plot package.


The cowplot package is meant to provide a publication-ready theme for ggplot2, one that requires a minimum amount of fiddling with sizes of axis labels, plot backgrounds, etc. It meets my personal needs; you may or may not like my style.

The package also fixes a couple of other annoyances that I encountered when trying to use ggplot2 for publication-ready figures, in particular with respect to combining multiple plots into one figure and labeling these plots. It turns out that the easiest way to fix these issues was to implement a general-purpose drawing canvas on top of ggplot2, so as a side effect of this work you can do pretty crazy effects with ggplot2 graphs.

This package is available on CRAN here and can be installed via

install.packages("cowplot")

You can install the latest development version of this package using the devtools package. In your R console, simply enter:

devtools::install_github("wilkelab/cowplot")

Note that cowplot is in the early stages of development. While you may find it useful for certain graphing problems you encounter, it may have major problems or undergo substantial changes in the future. In particular, at this point I make no guarantees that the default theme will remain unchanged.

Usage

To get a quick introduction to the main features of this package, read the vignettes provided with the package on CRAN.

News

  • Adds a get_legend() function that extracts the legend from a plot. Code provided by https://github.com/marcus1487
  • Fixes bug that creates an empty page on some plot devices. Fix provided by https://github.com/marcus1487
  • Fixes bug that hardcoded panel border line-type and size. Fix provided by Spencer Fox, https://github.com/sjfox
  • Adds the option of custom axes on the drawing layer. Code provided by https://github.com/zaczap
  • Separates out the alignment function from plot_grid(). Will likely be more useful further down the line. Code provided by Spencer Fox, https://github.com/sjfox
  • Updated plot_grid vignette so the tutorial on aligning plots of different types works again. This stopped working at some point and was removed from 0.6.1.
  • Added new convenience function draw_figure_label() to label figures with labels such as "Figure 1".
  • Fixes in switch_axis_position() so that rotated axis labels work.
  • Fix missing axis lines in ggplot2 2.1

Major changes:

  • Now requires ggplot2 version 2.0.0 or higher. Use cowplot 0.5.0 with older versions of ggplot2.
  • Because of the dependency on ggplot2 2.0.0, the default design is changed. No more bold face for axis labels
  • Add auto-generation of labels in plot_grid()
  • Add vignettes describing plot annotations and shared legends among plots

Major changes:

  • Fix label positioning in plot_grid() so it is not affected by the scale parameter
  • Add draw_label() function which can draw both text and plotmath expressions
  • Add parameters hjust and vjust to plot_grid() to allow fine-tuning of label position
  • Add annotations underneath plot, via add_sub() function

Other changes:

  • Improve vignettes

Major changes:

  • Added a function switch_axis_position() which can move/copy the x and/or y axis of a plot to the other side
  • plot_grid() can now align graphs
  • plot_grid() can now make grids with varying column widths and row heights

Other changes:

  • Various improvements in the documentation
  • Code has been separated into multiple files for easier maintenance

Fix Vignette title

First complete implementation ready for initial release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("cowplot")

0.7.0 by Claus O. Wilke, 7 months ago


https://github.com/wilkelab/cowplot


Report a bug at https://github.com/wilkelab/cowplot/issues


Browse source code at https://github.com/cran/cowplot


Authors: Claus O. Wilke [aut, cre], Hadley Wickham [cph]


Documentation:   PDF Manual  


GPL-2 license


Imports grid, gtable, plyr, grDevices, methods, utils

Depends on ggplot2

Suggests knitr


Imported by IncucyteDRC, oddsratio, preText, tadaatoolbox.

Depended on by JWileymisc.

Suggested by DGCA, deconvolveR, jtools, poppr.


See at CRAN