Description Usage Arguments Value Note
View source: R/helper_functions.R
bar plots(ggplot style)
1 2 |
df |
A data.frame |
x |
(str) column to plot x (column name), categorial value |
y |
(str) column to plot y (column name), numerical value |
palette_defined |
(bool) indicate whether to use as named palette list as defined in palette. default = F: use ggplot default colour scheme |
palette |
[optional] (named str) define the colour of the factor levels |
title |
[optional] (str) title of the plot, default none |
x_angle |
[optional] (num) angle of x axis labels, default = 45 |
text_size |
(num) plot title size, default = 8 |
log_y |
(bool) If True, log 10 scale y axis. default = F |
... |
other param in the ggplot2::geom_bar() |
A ggplot bar plot
use palette to define color for the factors. The palette list is a named list of colors. The names are corresponding to the factor levels e.g. palette <- c(red = "#ff0000", blue="#333BFF", pink ="#DD1C77", orange = "#CC6600", purple ="#9633FF",l_blue = "#00ffff", l_green = "#9bbc57", yellow = "#ffe700", salmon = "#ff7856",l_purple = "#e47fff")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.