Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/wilkox/ggwrap

🌯 Wrap ggplot2 plots over multiple rows
https://github.com/wilkox/ggwrap

Last synced: 3 months ago
JSON representation

🌯 Wrap ggplot2 plots over multiple rows

Lists

README

        

---
output:
github_document:
html_preview: true
toc: true
fig_width: 8
fig_height: 8
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```

[![Travis-CI Build Status](https://travis-ci.org/wilkox/ggwrap.svg?branch=master)](https://travis-ci.org/wilkox/ggwrap)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/ggwrap)](https://cran.r-project.org/package=ggwrap)
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)

'ggwrap' wraps a 'ggplot2' plot over multiple rows, to make plots with long x axes easier to read.

# Installation

The development version of 'ggwrap' can be installed from GitHub:

```{r eval = F}
devtools::install_github("wilkox/ggwrap")
```

# Usage

The `ggwrap` function takes two arguments: a 'ggplot2' plot, and the number of
rows over which the plot should be wrapped.

Here's a simple plot.

```{r}
library(ggplot2)
library(ggwrap)
plot <- ggplot(economics, aes(x = date, y = unemploy, colour = uempmed)) +
geom_line()
plot
```

We can use `ggwrap` to wrap the plot over four rows.

```{r}
ggwrap(plot, 4)
```