Learn R Programming

cowplot – Streamlined plot theme and plot annotations for ggplot2

The cowplot package provides various features that help with creating publication-quality figures, such as a set of themes, functions to align plots and arrange them into complex compound figures, and functions that make it easy to annotate plots and or mix plots with images. The package was originally written for internal use in the Wilke lab, hence the name (Claus O. Wilke's plot package). It has also been used extensively in the book Fundamentals of Data Visualization.

Installation

The cowplot package is available on CRAN and can be installed via

install.packages("cowplot")

To install the latest development version of the package using the devtools package, enter the following in your R console:

remotes::install_github("wilkelab/cowplot")

Usage

To get a quick introduction to the main features of this package, read the introductory vignette. For a more in-depth discussion, read all vignettes and/or the reference documentation.

Copy Link

Version

Install

install.packages('cowplot')

Monthly Downloads

387,119

Version

1.1.3

License

GPL-2

Maintainer

Last Published

January 22nd, 2024

Functions in cowplot (1.1.3)

draw_image

Draw an image
draw_line

Draw a line from connected points
get_legend

Retrieve the legend of a plot
draw_plot

Draw a (sub)plot.
draw_label

Draw a text label or mathematical expression.
draw_text

Draw multiple text-strings in one go.
get_title

Get plot titles
draw_plot_label

Add a label to a plot
get_plot_component

Get plot components
get_panel

Retrieve the panel or part of a panel of a plot
ggsave2

Cowplot reimplementation of ggsave().
plot_grid

Arrange multiple plots into a grid
png_null_device

Null devices
gtable_remove_grobs

Remove named elements from gtable
get_y_axis

Get plot axes
ggdraw

Set up a drawing layer on top of a ggplot
rectangle_key_glyph

Create customizable legend key glyphs
insert_xaxis_grob

Insert an axis-like grob on either side of a plot panel in a ggplot2 plot.
set_null_device

Sets the null graphics device
panel_border

Add/remove the panel border in a ggplot2 plot
stamp

Stamp plots with a label, such as good, bad, or ugly.
save_plot

Alternative to ggsave(), with better support for multi-figure plots.
theme_cowplot

Create the default cowplot theme
theme_map

Create a theme for map plotting
gtable_squash_rows

Set the height of given rows to 0.
theme_minimal_grid

Minimalistic themes with grids
gtable_squash_cols

Set the width of given columns to 0.
theme_nothing

Create a completely empty theme
as_gtable

Convert plot or other graphics object into a gtable
draw_figure_label

Add a label to a figure
background_grid

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

Convert a base plot or a ggplot2 plot into a grob
align_plots

Align multiple plots vertically and/or horizontally
add_sub

Add annotation underneath a plot
cowplot-package

Streamlined Plot Theme and Plot Annotations for 'ggplot2'
axis_canvas

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

Draw a grob.
align_margin

Align multiple plots along a specified margin