quik_bars: Plot a quik bar plot

Description Usage Arguments Examples

View source: R/plots.R

Description

ggquik has specific standards for plots, and quik_bars helps your plot follow these.

Usage

1
2
3
4
5
quik_bars(df, dimension, measure, groups, position,
                  text_size, alt_text_size, alt_label, facet_by, background,
                  flip_plot, dim_breaks, palette_type, colors,
                  currency, measure_unit, measure_decimal,
                  v.just, text_cutoff, ...)

Arguments

df

The data frame containing plot data

dimension

Usually the x-axis, values like "quarter" or "account type"

measure

The column containing numerical values to be plotted

groups

If a stacked or dodged bar, the column containing the groups

position

If groups, whether to "stack" (default) or "dodge" the groups.

text_size

A numeric. The size of the text within the bars (default is 3)

alt_text_size

A numeric. The size of the alternative text (default is 3)

alt_label

The column containing an alternate label (if any)

facet_by

The column to add facets to the plot (if necesary)

background

If using facet_by, should background totals be added?

flip_plot

A logical. Should the plot coordinates be flipped?

dim_breaks

A vector of specific dimensions values that should be labeled.

palette_type

A string. Allowed values are "diverging", "sequential", and "qualitative". Default is "qualitative".

colors

A string. What color should be used for the bars (e.g. "gray", "red", "dark red", "blue", "dark blue", "light blue", gold", "green", "purple", "teal")

currency

A string, usually $

measure_unit

A string. Can be %, K, or M

measure_decimal

An integer. The number of decimal places to show. Default is 0.

v.just

A numeric. The vertical adjustment for the text.

text_cutoff

A number. If text values below a certain number should not be included.

...

Additional parameters to pass on it facet_wrap (e.g. scales = free, ncol = 1)

Examples

1
2
3
4
# Create a bar plot from morley data
data(morley)
ggq <- quik_bars(morley, dimension = 'Run', measure = 'Speed', groups = 'Expt')
quik_theme(ggq, axis.text = 'y', axis.title = c('x', 'y'))

brascoball/ggquik documentation built on Feb. 14, 2021, 5:17 p.m.