Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mikmart committed Apr 24, 2023
2 parents 43aa2b1 + 054e6c1 commit 513525d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Imports:
Suggests:
covr,
knitr,
nlme,
ragg,
rmarkdown,
testthat (>= 3.0.0),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* Added a vignette showing examples of usage in broader context.
* Fixed an issue that caused the package to fail to build (with an "argument is
missing" error message) when an older versions of ggplot2 was installed.
missing" error message) when an older version of ggplot2 was installed.

# ggragged 0.1.0

Expand Down
21 changes: 12 additions & 9 deletions vignettes/ggragged.Rmd
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
---
title: "Ragged Grids for 'ggplot2'"
title: "Ragged grids for ggplot2"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Ragged Grids for 'ggplot2'}
%\VignetteIndexEntry{Ragged grids for ggplot2}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
fig.dpi = 96,
fig.width = 7.0,
fig.height = 4.5
)
```

Expand All @@ -24,11 +27,10 @@ groups.
Here we showcase some examples of applying ragged grid layouts.

```{r setup}
library(ggplot2)
library(ggragged)
```

## Example: Imbalanced grid
## Example: Imbalanced rows

The motivation for creating ggragged came in the context of a phase I clinical
trial---a dose-escalation study that enrolled cohorts of different sizes.
Expand All @@ -55,9 +57,10 @@ Theoph2 <- subset(Theoph2, Subject != "204")
with(Theoph2, table(Cohort, Subject))
```

The standard tool for visualizing individual subject profiles is `facet_wrap()`.
However, due to the imbalanced group sizes, the result here does not do a great
job at communicating the cohort structure in the data:
We are interested in visualizing drug concentrations over time after a single
dose for each subject. The standard tool for that is `facet_wrap()`. However,
due to the imbalanced group sizes, the result here does not do a great job at
communicating the cohort structure in the data:

```{r sad-wrap}
p <- ggplot(Theoph2, aes(Time, conc)) + geom_line()
Expand All @@ -83,7 +86,7 @@ p + facet_ragged_rows(vars(Cohort), vars(Subject), labeller = label_both, scales
This effect would not be possible with `facet_wrap()`, where we could only have
axis ranges vary between all panels, or none at all.

## Example: Balanced grid
## Example: Balanced columns

Ragged grid layouts can be useful in a balanced group setting, too. They can still
clarify the nesting hierarchy between faceting variables in the panel layout.
Expand Down

0 comments on commit 513525d

Please sign in to comment.