Skip to contents

# Simple bar chart

Source: `R/bar.R`
`bar_reach.Rd`

`ggblanket` as internals for deciding whether the bar chart is horizontally readable.

## Usage

    bar_reach(
      df,
      x,
      y,
      group = NULL,
      percent = TRUE,
      palette = "main",
      reverse = FALSE,
      family = "Leelawadee",
      alpha = 1,
      width = 0.5,
      x_title = NULL,
      y_title = NULL,
      group_title = NULL,
      position = "dodge",
      title = NULL,
      subtitle = NULL,
      caption = NULL,
      text_size = 10,
      title_size = 14,
      legend_position = "right",
      legend_rev = TRUE,
      ...
    )

## Arguments

df

  A data frame.

x

  A numeric column.

y

  A character column or coercible as a character column.

group

  Some grouping categorical column, e.g. administrative areas or population groups.

percent

  TRUE or FALSE. Should the x-labels be displayed as percentages? Default to TRUE.

palette

  Palette name from 'pal_reach()'.

reverse

  Boolean indicating whether the palette should be reversed.

family

  The font family for all plot's texts. Default to "Leelawadee".

alpha

  Transparency.

width

  Width.

x_title

  The x scale title. Default to NULL.

y_title

  The y scale title. Default to NULL.

group_title

  The group legend title. Default to NULL.

position

  Should the chart be stacked? Default to "dodge". Can take "dodge" and "stack".

title

  Plot title. Default to NULL.

subtitle

  Plot subtitle. Default to NULL.

caption

  Caption title string. Default to NULL.

text_size

  The size of all text other than the title, subtitle and caption. Defaults to 10.

title_size

  The size of the title text. Defaults to 14.

legend_position

  Position of the legend; Default to "right". Can take "right", "left", "top", "bottom" or "none".

legend_rev

  Reverse the color in the guide? Default to TRUE.

...

  Other arguments to be passed to "ggblanket::gg_col"

## Value

A bar chart