View source: R/functions_exploration.R
plot_correlation | R Documentation |
plots correlation of two variables. Point plot is available for numeric features and bar plot or bubble plot of the contingency matrix for factors.
plot_correlation(
data,
variables,
type = c("correlation", "bar", "bubble"),
scale = c("none", "percent", "fraction"),
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,
signif_digits = 2,
txt_size = 2.75
)
data |
a data frame. |
variables |
a vector with variable names. If more than two provided, only the first two are analyzed. |
type |
type of the plot. 'correlation' returns a standard point plot, 'bar' returns a bar plot of frequencies, 'bubble' represents the contingency matrix as a bubble plot. |
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? |
signif_digits |
significant digits used for the label value rounding. |
txt_size |
size of the text label. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.