Skip to contents

This function allows you to plot various types of plots that have passes as some sort of input. Compatible with any data frame of any data type. Returns a ggplot object.

Usage

plot_scatter(
  data,
  x = "",
  y = "",
  label = "",
  set_size_num = 5,
  set_size_var = "",
  set_color_num = "red",
  set_color_var = "",
  title = "",
  title_size = 25,
  subtitle = "",
  subtitle_size = 15,
  caption = "",
  caption_size = 10,
  theme = "classic"
)

Arguments

data

the dataframe passed in for plotting.

x

name of column name in data to be used on x-axis

y

name of column name in data to be used on y-axis

label

the name of column name in data to label the scatter plot

set_size_num

sets the size of the points set as a constant. Default size = 5.

set_size_var

Enter name of column name in data to set size based on variable.

set_color_num

sets the color of the points set as a constant. Can enter hexcode or a valid ggplot2 color. Default = "red"

set_color_var

Enter name of column name in data to set color based on variable.

title

pick the title of the scatter plot

title_size

sets the size of the title of the scatter plot. Default size = 25.

subtitle

pick the subtitle of the scatter plot

subtitle_size

sets the size of the subtitle of the scatter plot Default size = 15.

caption

pick the caption of the scatter plot

caption_size

sets the size of the caption of the scatter plot. Default size = 10.

theme

decide the theme of the plot between four choices: classic, minimal, grey, bw. Default = "classic"

Value

returns a ggplot2 object

Examples

if (FALSE) {
plot <- plot_scatter(data, x = "player", y = "age", label = "team")
plot
}