plot_pairs | R Documentation |
Function produces a ggplot2 based scatter plot of all pairs of a dataframe's variables.
In creating the 'var_name_scaling' list, if we are looking at some regression model, then suggest listing the response variable last.
plot_pairs(
df,
var_name_scaling,
title = NULL,
title_sz = 14,
axis_text_sz = 6,
rot_y_tic_label = FALSE,
plot_dim = 12
)
df |
The required data frame from which the scatter plots' values are derived and laid out in a matrix like fashion. |
var_name_scaling |
A required named list where the name is the variable name from 'df'
and the value is a vector defining the corresponding major axis scaling breaks. If the value
is |
title |
A string that sets the overall title. |
title_sz |
A numeric that sets the title's font size. Default is 14. |
axis_text_sz |
A numeric that sets the font size along the axis'. Default is 6. |
rot_y_tic_label |
A logical which if TRUE rotates the y tic labels 90 degrees for enhanced readability. |
plot_dim |
A numeric that sets the overall width/height of the plot in centimeters. |
a ggplot2 plot object
library(ggplot2)
library(ggplotify)
library(gtable)
library(data.table)
library(RplotterPkg)
library(RregressPkg)
# Advertising media
var_name_scaling_lst <- list(
TV = NULL,
radio = NULL,
newspaper = NULL,
sales = NULL
)
a_plot <- RregressPkg::plot_pairs(
df = RregressPkg::advertising,
var_name_scaling = var_name_scaling_lst,
title = "Advertising Predictors of Sales",
rot_y_tic_label = TRUE
)
# Timber volume
data(trees)
var_name_scaling_lst <- list(
Girth = seq(5, 25, 5),
Height = seq(60, 90, 5),
Volume = NULL
)
a_plot <- RregressPkg::plot_pairs(
df = trees,
var_name_scaling = var_name_scaling_lst,
title = "Cherry Trees"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.