plot_variable: Plot a variable in two or more data sets objects.

View source: R/functions_exploration.R

plot_variableR Documentation

Plot a variable in two or more data sets objects.

Description

Plots values of two or more EDA objects as a classical bar, violin, boxplot or correlation point plot representation.

Usage

plot_variable(
  ...,
  variable,
  split_factor = NULL,
  data_names = NULL,
  type = c("default", "bar", "violin", "box", "hist", "correlation", "paired", "stack"),
  scale = c("none", "fraction", "percent"),
  point_alpha = 0.5,
  point_hjitter = 0.05,
  point_wjitter = 0.1,
  point_color = "steelblue",
  point_size = 2,
  line_color = "black",
  line_alpha = 0.25,
  cust_theme = ggplot2::theme_classic(),
  plot_title = NULL,
  plot_subtitle = NULL,
  x_lab = NULL,
  y_lab = NULL,
  show_trend = TRUE,
  show_labels = TRUE,
  geom_label = TRUE,
  signif_digits = 2,
  txt_size = 2.75,
  txt_color = "black",
  bins = NULL,
  facet_hist = c("none", "horizontal", "vertical"),
  x_n_labs = FALSE
)

Arguments

...

data sets.

variable

variable name.

split_factor

optional, the name of a factor used for splitting the variables of interest into analysis groups.

data_names

a vector with names of the data sets.

type

type of the plot. 'default' plots violin for numeric variables and bars for factors. 'bar', 'bubble' and 'stack' (stacked bar plot) are available for factors. 'violin', 'box', 'hist', 'correlation' and 'paired' are available for numeric variables.

scale

the feature to be presented in factor bar plots. 'none' plots counts, 'percent' plots percentages, 'fraction' presents fraction fo complete observations.

point_alpha

alpha of the plot points.

point_hjitter

point jitter height.

point_wjitter

point jitter width.

point_color

color of the points in the correlation plot.

point_size

size of the points in the plots.

line_color

color of the trend line in the correlation plots or the connecting lines in the paired plots.

line_alpha

opacity of the connecting lines in the paired plot.

cust_theme

custom ggplot2 theme.

plot_title

text to be presented in the plot title.

plot_subtitle

text to be presented in the plot subtitle.

x_lab

text to be presented in the X axis title.

y_lab

text to be presented in the Y axis title.

show_trend

logical, should a trend line with 95% confidence intervals be presented in the correlation plots?

show_labels

logical, should labels with count numbers, percentages or fractions be presented in bar plots?

geom_label

logical, should the text in the stacked bar plot be presented as a ggplot's geom_label?

signif_digits

significant digits used for the label value rounding.

txt_size

size of the text label.

txt_color

color of the text label.

bins

bin number, passed to histogram.

facet_hist

'none': histograms are overlaid, 'horizontal': horizontal or 'vertical': vertical faceting.

x_n_labs

logical. If TRUE, n numbers per strata are displayed in the X axis of the plot instead of the plot tag. Defaults to FALSE and concerns violin, box, paired and stack plots.

Details

the particular data sets representations are color coded. In case, the split_factor is provided, only the first of the input data frames will be plotted.


PiotrTymoszuk/ExDA documentation built on Nov. 17, 2024, 5:46 p.m.