Learn R Programming

⚠️There's a newer version (1.1.3) of this package.Take me there.

cowplot – An add-on to the ggplot2 plotting 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.

Installation

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.

Copy Link

Version

Install

install.packages('cowplot')

Monthly Downloads

390,013

Version

0.9.3

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Claus O Wilke

Last Published

July 15th, 2018

Functions in cowplot (0.9.3)

theme_cowplot

Create the default cowplot theme
plot_to_gtable

Convert plot or other graphics object into a gtable
panel_border

Add/remove the panel border in a ggplot2 plot
plot_grid

Arrange multiple plots into a grid
gtable_squash_rows

Set the height of given rows to 0.
insert_xaxis_grob

save_plot

Alternative to ggsave, with better support for multi-figure plots.
theme_nothing

Create a completely empty theme
draw_plot

Draw a (sub)plot.
theme_map

Create a theme for map plotting
add_sub

Add annotation underneath a plot
align_plots

Align multiple plots vertically and/or horizontally
background_grid

Add/modify/remove the background grid in a ggplot2 plot
draw_figure_label

Add a label to a figure
cowplot

cowplot.
draw_label

Draw a text label or mathematical expression.
draw_image

Draw an image
axis_canvas

Generates a canvas onto which one can draw axis-like objects.
draw_grob

Draw a grob.
draw_plot_label

Add a label to a plot
draw_text

Draw multiple text-strings in one go.
align_margin

Align multiple plots along a specified margin
get_panel

Retrieve the panel of a plot
get_legend

Retrieve the legend of a plot
gtable_remove_grobs

Remove named elements from gtable
gtable_squash_cols

Set the width of given colums to 0.
ggsave

Cowplot reimplementation of ggsave.
ggdraw

Set up a drawing layer on top of a ggplot
draw_line

Draw a line from connected points