View source: R/plt_labeled_pts.R
plt_labeled_pts | R Documentation |
Visualize a blob of 2-D data points in space, with nearly non-overlapping labels for the points.
plt_labeled_pts(
df,
xvar,
yvar,
pt_label_var,
title = "Multidimensional Scaling Result",
repel_force = 10
)
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. |
A ggplot2 scatterplot with labeled points.
mtcars$car_types = row.names(mtcars)
plt_labeled_pts(mtcars, xvar = 'mpg', yvar = 'wt', pt_label_var = 'car_types')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.