gg_linerange {ggblanket} | R Documentation |
Linerange ggplot
Description
Create a linerange ggplot with a wrapper around ggplot2::ggplot()
+ geom_linerange().
Usage
gg_linerange(
data = NULL,
...,
stat = "identity",
position = "identity",
coord = ggplot2::coord_cartesian(clip = "off"),
mode = NULL,
x = NULL,
xmin = NULL,
xmax = NULL,
xend = NULL,
y = NULL,
ymin = NULL,
ymax = NULL,
yend = NULL,
z = NULL,
col = NULL,
facet = NULL,
facet2 = NULL,
group = NULL,
subgroup = NULL,
label = NULL,
text = NULL,
sample = NULL,
mapping = NULL,
x_breaks = NULL,
x_expand = NULL,
x_expand_limits = NULL,
x_labels = NULL,
x_limits = NULL,
x_oob = scales::oob_keep,
x_position = "bottom",
x_title = NULL,
x_transform = NULL,
y_breaks = NULL,
y_expand = NULL,
y_expand_limits = NULL,
y_labels = NULL,
y_limits = NULL,
y_oob = scales::oob_keep,
y_position = "left",
y_title = NULL,
y_transform = NULL,
col_breaks = NULL,
col_expand_limits = NULL,
col_labels = NULL,
col_legend_ncol = NULL,
col_legend_nrow = NULL,
col_legend_rev = FALSE,
col_limits = NULL,
col_oob = scales::oob_keep,
col_palette = NULL,
col_palette_na = NULL,
col_rescale = scales::rescale(),
col_steps = FALSE,
col_title = NULL,
col_transform = NULL,
facet_axes = NULL,
facet_axis_labels = "margins",
facet_labels = NULL,
facet_layout = NULL,
facet_ncol = NULL,
facet_nrow = NULL,
facet_scales = "fixed",
facet_space = "fixed",
title = NULL,
subtitle = NULL,
caption = NULL,
titles_to_case = snakecase::to_sentence_case
)
Arguments
data |
A data frame or tibble. |
... |
Other arguments passed to within a |
stat |
A statistical transformation to use on the data. A snakecase character string of a ggproto Stat subclass object minus the Stat prefix (e.g. |
position |
A position adjustment. A snakecase character string of a ggproto Position subclass object minus the Position prefix (e.g. |
coord |
A coordinate system. A |
mode |
A |
x , xmin , xmax , xend , y , ymin , ymax , yend , z , col , facet , facet2 , group , subgroup , label , text , sample |
An unquoted aesthetic variable. |
mapping |
A set of additional aesthetic mappings in |
x_breaks , y_breaks , col_breaks |
A |
x_expand , y_expand |
Padding to the limits with the |
x_expand_limits , y_expand_limits , col_expand_limits |
For a continuous variable, any values that the limits should encompass (e.g. |
x_labels , y_labels , col_labels , facet_labels |
A function that takes the breaks as inputs (e.g. |
x_limits , y_limits , col_limits |
For a continuous scale, a vector of length 2 to determine the limits of the scale. For a discrete scale, manipulate the data instead with |
x_oob , y_oob , col_oob |
For a continuous scale, a |
x_position , y_position |
The position of the axis (i.e. |
x_title , y_title , col_title |
Axis title string. Use |
x_transform , y_transform , col_transform |
For a continuous scale, a transformation object (e.g. |
col_legend_ncol , col_legend_nrow |
The number of columns and rows in a legend guide. |
col_legend_rev |
|
col_palette |
Colour palette to use. A character vector of hex codes (or names). |
col_palette_na |
Colour palette to use for |
col_rescale |
For a continuous variable, a |
col_steps |
For a continuous variable, |
facet_axes |
Whether to add interior axes and ticks with |
facet_axis_labels |
Whether to add interior axis labels with |
facet_layout |
Whether the layout is to be |
facet_ncol , facet_nrow |
The number of columns and rows of facet panels. Only applies to a facet layout of |
facet_scales |
Whether facet scales should be |
facet_space |
When the facet layout is |
title |
Title string. |
subtitle |
Subtitle string. |
caption |
Caption title string. |
titles_to_case |
A function to format unspecified titles. Defaults to |
Value
A ggplot object.
Examples
library(ggplot2)
library(dplyr)
set_blanket()
data.frame(
trt = factor(c(1, 1, 2, 2)),
resp = c(1, 5, 3, 4),
group = factor(c(1, 2, 1, 2)),
upper = c(1.1, 5.3, 3.3, 4.2),
lower = c(0.8, 4.6, 2.4, 3.6)) |>
gg_linerange(
x = trt,
ymin = lower,
ymax = upper,
col = group,
position = position_dodge(width = 0.2),
x_title = "Treatment",
y_title = "Response",
)