
Column Chart
col_chart.Rd
Creates a column chart using either ggplot2 (static) or plotly (dynamic).
Usage
col_chart(
dynamic = FALSE,
base = NULL,
params = list(df = NULL, x = NULL, y = NULL, group_var = NULL, fill = "blue", y_axis =
"y1", position = "dodge", ci = NULL, lower = NULL, upper = NULL, error_colour =
"red", h_line = NULL, y_label = NULL, x_label = NULL, x_label_angle = NULL,
y_label_angle = NULL, x_labels_reverse = NULL, y_min_limit = NULL, y_max_limit =
NULL, x_axis_breaks = NULL, legend_pos = "bottom", remove_gridlines = NULL, percent =
NULL, cap_text = NULL, no_shift = FALSE),
...
)
Arguments
- dynamic
Logical indicating whether to produce a dynamic (plotly) output. Default is FALSE, which will return a static ggplot output.
- base
A base ggplot object to add the column chart to. Default is NULL.
- params
A named list containing arguments used to create the plot:
df: The dataframe containing the data to be plotted
x: The x value column name to be plotted
y: The y value column name to be plotted
group_var: The variable used to group the bars i.e. region if plotting by region
fill: The colour with which to fill the columns
y_axis: Either "y1" for primary y-axis or "y2" for secondary y-axis
position: The positions of the bars to be plotted i.e."dodge", "stack" etc
ci: Indicator for using ribbon or error bar geom (if required), enter 'e' for error bar, enter any other value for ribbon
lower: Lower value for error/ribbon geom (mandatory if ci argument passed)
upper: Upper value for error/ribbon geom (mandatory if ci argument passed)
error_colour: If not plotting by group this is the colour of the error bars or ribbon
h_line: Will display a horizontal line if valid integer passed
y_label: For provision of an y axis label
x_label: For provision of an x axis label
x_label_angle: To adjust the x axis label by the degrees of the integer provided
y_label_angle: To adjust the y axis label by the degrees of the integer provided
x_labels_reverse: Enter an argument of any value i.e. 'y' to reverse the x labeling order
y_min_limit: Set the limit on the y axis scaling by proving an integer
y_max_limit: Set the limit on the x axis scaling by proving an integer
x_axis_breaks: Modify the x axis breaks by providing an integer
legend_pos: Modify the position of the legend (where applicable)
remove_gridlines: Enter an argument of any value i.e. 'y' to remove grid lines
percent: Enter an argument of any value i.e. 'y' to include the % symbol
cap_text: Enter text for a caption to appear below plot
no_shift: If no shift should be applied to the secondary y-axis
- ...
Additional arguments passed to geom_col for static (ggplot2) plots or to plot_ly/add_trace for dynamic (Plotly) plots, allowing custom styling of the columns (e.g., alpha, width, marker, etc.).