gg_step | R Documentation |
Create a step plot with a wrapper around ggplot2::ggplot()
+ geom_step().
gg_step(
data = NULL,
...,
stat = "identity",
position = "identity",
coord = ggplot2::coord_cartesian(clip = "off"),
mode = NULL,
mode_orientation = NULL,
blend = 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_breaks_n = NULL,
x_expand = NULL,
x_expand_limits = NULL,
x_label = NULL,
x_labels = NULL,
x_position = "bottom",
x_sec_axis = ggplot2::waiver(),
x_symmetric = NULL,
x_transform = NULL,
y_breaks = NULL,
y_breaks_n = NULL,
y_expand = NULL,
y_expand_limits = NULL,
y_label = NULL,
y_labels = NULL,
y_position = "left",
y_sec_axis = ggplot2::waiver(),
y_symmetric = NULL,
y_transform = NULL,
col_breaks = NULL,
col_breaks_n = 5,
col_drop = FALSE,
col_expand_limits = NULL,
col_label = NULL,
col_labels = NULL,
col_legend_ncol = NULL,
col_legend_nrow = NULL,
col_legend_rev = FALSE,
col_palette = NULL,
col_palette_na = NULL,
col_rescale = scales::rescale(),
col_steps = FALSE,
col_transform = NULL,
facet_axes = NULL,
facet_axis_labels = "margins",
facet_drop = FALSE,
facet_labels = NULL,
facet_layout = NULL,
facet_ncol = NULL,
facet_nrow = NULL,
facet_scales = "fixed",
facet_space = "fixed",
title = NULL,
subtitle = NULL,
caption = NULL,
label_to_case = snakecase::to_sentence_case
)
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 ggplot2 theme (e.g. |
mode_orientation |
The orientation of plot, which affects the theme components that are removed from the mode. Either "x" or "y". |
blend |
The blending mode per |
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_breaks_n , y_breaks_n , col_breaks_n |
A number of desired breaks for when |
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_label , y_label , col_label |
Label for the axis or legend title. Use |
x_labels , y_labels , col_labels , facet_labels |
A function that takes the breaks as inputs (e.g. |
x_position , y_position |
The position of the axis (i.e. |
x_sec_axis , y_sec_axis |
A secondary axis with |
x_symmetric , y_symmetric |
|
x_transform , y_transform , col_transform |
For a continuous scale, a transformation object (e.g. |
col_drop , facet_drop |
For a discrete variable, FALSE or TRUE of whether to drop unused levels. |
col_legend_ncol , col_legend_nrow |
The number of columns and rows in a legend guide. |
col_legend_rev |
|
col_palette |
A character vector of hex codes (or names) or a |
col_palette_na |
A hex code (or name) for the colour of |
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 scales are not |
title |
Title string. |
subtitle |
Subtitle string. |
caption |
Caption title string. |
label_to_case |
A function to format the default |
A ggplot object.
library(ggplot2)
library(dplyr)
set_blanket()
economics |>
filter(date > lubridate::ymd("2010-01-01")) |>
gg_step(
x = date,
y = unemploy,
y_expand_limits = 0,
y_label = "Unemployment",
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.