Skip to contents

Professional scatter plot with smart aesthetic detection.

Usage

ekio_scatterplot(
  data,
  x,
  y,
  color = NULL,
  size = NULL,
  palette = NULL,
  add_zero = FALSE,
  add_smooth = FALSE,
  smooth_method = "lm",
  point_size = 2.5,
  point_alpha = 0.8,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ...
)

Arguments

data

A data frame

x

X-axis variable (supports data-masking)

y

Y-axis variable (supports data-masking)

color

Color aesthetic. A color string or a variable. A continuous variable warns and uses a sequential ramp.

size

Size aesthetic (optional variable)

palette

Character. Palette name for variable mappings.

add_zero

Logical. Add horizontal line at y=0 (default: FALSE)

add_smooth

Logical. Add smooth trend line (default: FALSE)

smooth_method

Smoothing method: "lm", "gam", "loess" (default: "lm")

point_size

Base point size (default: 2.5)

point_alpha

Point transparency (default: 0.8)

title, subtitle, caption

Plot labels. NULL (default) draws none.

...

Additional arguments passed to ggplot2::geom_point(). These override the recipe's own geom defaults.

Value

ggplot2 object

Examples

ekio_scatterplot(mtcars, wt, mpg)

ekio_scatterplot(mtcars, wt, mpg, color = factor(cyl))