Description Usage Arguments Value Examples
Creates a scatter plot and calculates a correlation between two variables
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | scatterplot(
data = NULL,
x_var_name = NULL,
y_var_name = NULL,
point_label_var_name = NULL,
weight_var_name = NULL,
alpha = 1,
annotate_stats = FALSE,
line_of_fit_type = "lm",
ci_for_line_of_fit = FALSE,
x_axis_label = NULL,
y_axis_label = NULL,
point_labels_size_range = c(3, 12),
jitter_x_percent = 0,
jitter_y_percent = 0
)
|
data |
a data object (a data frame or a data.table) |
x_var_name |
name of the variable that will go on the x axis |
y_var_name |
name of the variable that will go on the y axis |
point_label_var_name |
name of the variable that will be used to label individual observations |
weight_var_name |
name of the variable by which to weight the individual observations for calculating correlation and plotting the line of fit |
alpha |
opacity of the dots (0 = completely transparent, 1 = completely opaque) |
annotate_stats |
if |
line_of_fit_type |
if |
ci_for_line_of_fit |
if |
x_axis_label |
alternative label for the x axis |
y_axis_label |
alternative label for the y axis |
point_labels_size_range |
minimum and maximum size for dots on the plot when they are weighted |
jitter_x_percent |
horizontally jitter dots by a percentage of the range of x values |
jitter_y_percent |
vertically jitter dots by a percentage of the range of y values |
a ggplot object
1 2 3 4 5 6 7 | scatterplot(data = mtcars, x_var_name = "wt", y_var_name = "mpg")
scatterplot(data = mtcars, x_var_name = "wt", y_var_name = "mpg",
point_label_var_name = "hp", weight_var_name = "drat",
annotate_stats = TRUE)
scatterplot(data = mtcars, x_var_name = "wt", y_var_name = "mpg",
point_label_var_name = "hp", weight_var_name = "cyl",
annotate_stats = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.