Create a bar plot visualisation from a <summarised_result>
object
Usage
barPlot(
result,
x,
y,
width = NULL,
just = 0.5,
position = "dodge",
facet = NULL,
colour = NULL,
style = "default",
type = "ggplot",
label = character()
)
Arguments
- result
A
<summarised_result>
object.- x
Column or estimate name that is used as x variable.
- y
Column or estimate name that is used as y variable.
- width
Bar width, as in
geom_col()
of theggplot2
package.- just
Adjustment for column placement, as in
geom_col()
of theggplot2
package.- position
Position of bars, can be either
dodge
orstack
- facet
Variables to facet by, a formula can be provided to specify which variables should be used as rows and which ones as columns.
- colour
Columns to use to determine the colours.
- style
A character string defining the visual theme to apply to the plot. You can set this to NULL to apply the standard ggplot2 default style, or provide a name for one of the package's pre-defined styles. Refer to the
plotStyle()
function for all available style pre-defined themes. For further customization, you can always modify the returned ggplot object directly.- type
The desired format of the output plot. See
plotType()
for supported plot types.- label
Character vector with the columns to display interactively in
plotly
.
Examples
result <- mockSummarisedResult() |> dplyr::filter(variable_name == "age")
barPlot(
result = result,
x = "cohort_name",
y = "mean",
facet = c("age_group", "sex"),
colour = "sex")
#> Warning: Ignoring empty aesthetic: `width`.