Generic function plot shows the points in a two-dimensional embedding or projection space with options for customization.

# S3 method for embedR_tbl
plot(
  data,
  dimensions = c(1, 2),
  size = NULL,
  color = NULL,
  label = NULL,
  label_size = 3,
  label_filter = NULL,
  pt_padding = 0.05,
  box_padding = 0.05,
  viridis_set = "E",
  viridis_limits = c(0, 0.9)
)

Arguments

data

a data.frame created using er_frame.

dimensions

an integer vector determining the dimensions plotted. Default is c(1, 2).

size

an optional character string specifying the column used to determine point size.

color

an optional character string specifying the column used to determine point (and label) color.

label

an optional character string specifying the column used to determine label texts.

label_size

an optional character string specifying the column used to determine label size.

label_filter

an optional logical comparison determining which label texts to show in the plot. Can be based on any columns in data.

pt_padding

a numeric specifying the point padding.

box_padding

a numeric specifying the label box padding.

viridis_set

a character string determining the viridis color set. See scale_color_viridis_d.

viridis_limits

a numeric vector of length 2 determining the begin and end arguments of scale_color_viridis_d.

Value

The function returns a ggplot2 object.

References

Wulff, D. U., Aeschbach, S., Hussain, Z., & Mata, R. (2024). embeddeR. In preparation.

Examples

if (FALSE) {
# get embedding plot
neo$text %>%
  er_embed() %>%
  er_project() %>%
  er_frame()
  plot()
}