plotDens: plotDens()

Description Usage Arguments Value Note

View source: R/helper_functions.R

Description

plot density (ggplot style)

Usage

1
2
3
plotDens(df, column, palette_defined = F, palette = "", group = "",
  title = "", facet_gp = "", x_angle = 45, text_size = 8,
  log_x = F, log_y = F, plt_alpha = 0.4, line_size = 1, ...)

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

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

text_size

(num) plot title size, default = 8

log_x

(bool) If True, log 10 scale x axis. default = F

log_y

(bool) If True, log 10 scale y axis. default = F

plt_alpha

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

line_size

(num) line size of the density lines. default = 1

...

other param in the ggplot2::geom_density()

Value

A ggplot density

Note

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")


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