plotHisto: plotHisto()

Description Usage Arguments Value Note

View source: R/helper_functions.R

Description

plot histogram(ggplot style)

Usage

1
2
3
plotHisto(df, column, palette_defined = F, palette = "",
  plt_alpha = 0.4, group = "", title = "", facet_gp = "",
  x_angle = 45, ...)

Arguments

df

A data.frame

column

(str) column to plot (column name)

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

plt_alpha

[optional] (num) plot alpha (transparency), default = 0.4

group

[optional] (str) fill colour by a column (column name), default is do not group by any column

title

[optional] (str) title of the plot, default none

facet_gp

[optional] (str) the column name for the facet group (as in facet_wrap())

x_angle

[optional] (num) angle of x axis labels, default = 45

...

other param in the ggplot2::geom_histogram()

Value

a ggplot histogram

Note

use palette to define color for the factor levels. 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")


BerylZhuang/helper_functions documentation built on March 15, 2021, 5:19 a.m.