Title: | Pirate plotting for ggplot2 |
---|---|
Description: | Extends ggplot2 to make it easy to create pirate plots. |
Authors: | Mika Braginsky [aut, cre] |
Maintainer: | Mika Braginsky <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2024-10-25 03:46:30 UTC |
Source: | https://github.com/mikabr/ggpirate |
A pirate plot
(https://cran.r-project.org/web/packages/yarrr/vignettes/pirateplot.html)
is a way of displaying data where a continuous dependent variable is a
function of a categorical independent variable, in a more informative way
than the traditional barplot. geom_pirate
plots the raw data as points
(using geom_jitter), along with layers showing descriptive
and inferential statistics – bars indicating means (using
geom_col), horizontal line indicating means (using
geom_crossbar), boxes indicating 95% confidence intervals
assuming a normal sampling distribution (using geom_tile),
and violins indicating the density (using geom_violin).
geom_pirate( mapping = NULL, data = NULL, ..., points = TRUE, bars = TRUE, lines = TRUE, cis = TRUE, violins = TRUE, points_params = list(shape = 1, size = 1), bars_params = list(alpha = 0.3, width = 0.9), lines_params = list(size = 0.5, width = 0.9), cis_params = list(fill = "white", size = 0.5, alpha = 0.5, width = 0.8), violins_params = list(fill = "white", size = 0.5, alpha = 0, width = 0.7), jitter_width = 0.2, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
geom_pirate( mapping = NULL, data = NULL, ..., points = TRUE, bars = TRUE, lines = TRUE, cis = TRUE, violins = TRUE, points_params = list(shape = 1, size = 1), bars_params = list(alpha = 0.3, width = 0.9), lines_params = list(size = 0.5, width = 0.9), cis_params = list(fill = "white", size = 0.5, alpha = 0.5, width = 0.8), violins_params = list(fill = "white", size = 0.5, alpha = 0, width = 0.7), jitter_width = 0.2, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
... |
Other arguments passed on to |
points |
logical indicating whether to show points |
bars |
logical indicating whether to show mean bars |
lines |
logical indicating whether to show mean lines |
cis |
logical indicating whether to show 95% confidence intervals boxes |
violins |
logical indicating whether to show violins |
points_params |
list of parameters to pass to points layer |
bars_params |
list of parameters to pass to bars layer |
lines_params |
list of parameters to pass to lines layer |
cis_params |
list of parameters to pass to CIs layer |
violins_params |
list of parameters to pass to violins layer |
jitter_width |
amount of horizontal jitter added to the locations of the points (defaults to 20% of the resolution of the data) |
na.rm |
If |
show.legend |
logical indicating whether this layer be included in the legends (defaults to FALSE) |
inherit.aes |
If |
ggplot(mpg, aes(x = class, y = cty)) + geom_pirate(aes(colour = class))
ggplot(mpg, aes(x = class, y = cty)) + geom_pirate(aes(colour = class))