visualizeR/man/bar.Rd

123 lines
3.2 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bar.R
\name{hbar}
\alias{hbar}
\alias{bar}
\title{Simple bar chart}
\usage{
hbar(
...,
flip = TRUE,
add_text = FALSE,
theme_fun = theme_bar(flip = flip, add_text = add_text)
)
bar(
df,
x,
y,
group = "",
facet = "",
order = "none",
x_rm_na = TRUE,
y_rm_na = TRUE,
group_rm_na = TRUE,
facet_rm_na = TRUE,
y_expand = 0.1,
add_color = color("cat_5_main_1"),
add_color_guide = TRUE,
flip = FALSE,
wrap = NULL,
position = "dodge",
alpha = 1,
x_title = NULL,
y_title = NULL,
group_title = NULL,
title = NULL,
subtitle = NULL,
caption = NULL,
width = 0.8,
add_text = FALSE,
add_text_size = 4.5,
add_text_color = color("dark_grey"),
add_text_font_face = "bold",
add_text_threshold_display = 0.05,
add_text_suffix = "\%",
add_text_expand_limit = 1.2,
add_text_round = 1,
theme_fun = theme_bar(flip = flip, add_text = add_text, axis_text_x_angle = 0,
axis_text_x_vjust = 0.5, axis_text_x_hjust = 0.5),
scale_fill_fun = scale_fill_visualizer_discrete(),
scale_color_fun = scale_color_visualizer_discrete()
)
}
\arguments{
\item{flip}{TRUE or FALSE (default). Default to TRUE or horizontal bar plot.}
\item{add_text}{TRUE or FALSE. Add values as text.}
\item{theme_fun}{Whatever theme function. For no custom theme, use theme_fun = NULL.}
\item{df}{A data frame.}
\item{x}{A quoted numeric column.}
\item{y}{A quoted character column or coercible as a character column.}
\item{group}{Some quoted grouping categorical column, e.g. administrative areas or population groups.}
\item{facet}{Some quoted grouping categorical column, e.g. administrative areas or population groups.}
\item{order}{A character scalar specifying the order type (one of "none", "y", "grouped"). See details.}
\item{x_rm_na}{Remove NAs in x?}
\item{y_rm_na}{Remove NAs in y?}
\item{group_rm_na}{Remove NAs in group?}
\item{facet_rm_na}{Remove NAs in facet?}
\item{y_expand}{Multiplier to expand the y axis.}
\item{add_color}{Add a color to bars (if no grouping).}
\item{add_color_guide}{Should a legend be added?}
\item{wrap}{Should x-labels be wrapped? Number of characters.}
\item{position}{Should the chart be stacked? Default to "dodge". Can take "dodge" and "stack".}
\item{alpha}{Fill transparency.}
\item{x_title}{The x scale title. Default to NULL.}
\item{y_title}{The y scale title. Default to NULL.}
\item{group_title}{The group legend title. Default to NULL.}
\item{title}{Plot title. Default to NULL.}
\item{subtitle}{Plot subtitle. Default to NULL.}
\item{caption}{Plot caption. Default to NULL.}
\item{width}{Bar width.}
\item{add_text_size}{Text size.}
\item{add_text_color}{Text color.}
\item{add_text_font_face}{Text font_face.}
\item{add_text_threshold_display}{Minimum value to add the text label.}
\item{add_text_suffix}{If percent is FALSE, should we add a suffix to the text label?}
\item{add_text_expand_limit}{Default to adding 10\% on top of the bar.}
\item{add_text_round}{Round the text label.}
}
\description{
`bar()` is a simple bar chart with some customization allowed, in particular the `theme_fun` argument for theming. `hbar()` uses `bar()` with sane defaults for a horizontal bar chart.
}