plt_labeled_pts: Plot scattered labeled points.

View source: R/plt_labeled_pts.R

plt_labeled_ptsR Documentation

Plot scattered labeled points.

Description

Visualize a blob of 2-D data points in space, with nearly non-overlapping labels for the points.

Usage

plt_labeled_pts(
  df,
  xvar,
  yvar,
  pt_label_var,
  title = "Multidimensional Scaling Result",
  repel_force = 10
)

Arguments

df

Data frame. Its rows are points and columns are dimensions.

xvar

String. Name of the variable to be put on the x-axis.

yvar

String. Name of the variable to be put on the y-axis.

pt_label_var

String. Name of the variable to label the points.

title

String. Plot title (default = "Multidimensional Scaling Result").

repel_force

Integer. Force of repulsion between overlapping text labels. Defaults to 10. If this value is too small, the labels often won't be repeled hard enough to completely avoid overlapping.

Value

A ggplot2 scatterplot with labeled points.

Examples

mtcars$car_types = row.names(mtcars)
plt_labeled_pts(mtcars, xvar = 'mpg', yvar = 'wt', pt_label_var = 'car_types')

cabaceo/shinymod documentation built on Sept. 8, 2023, 12:23 p.m.