Analyze the distribution of distances from keypoints to the centroid
Source:R/check_pose.R
check_pose.Rd
This function generates visualizations of the distances from each keypoint to a calculated centroid in the data. By default, it produces histograms of the distance distributions, but it can also create confidence plots if specified.
Arguments
- data
A data frame containing at least the columns
keypoint
,x
, andy
.- reference_keypoint
The keypoint used as a reference to calculate the distance.
- type
Character string specifying the type of plot to create. Options are:
"histogram"
: Histograms of the distance distributions (default)"confidence"
: Plots showing confidence intervals for the distances
Value
A patchwork
object combining plots for each keypoint, visualizing
the distances to the centroid.
Details
The centroid is computed using the add_centroid
function and distances are
calculated with the calculate_distance_to_centroid
function.
The function automatically excludes the centroid itself from the visualizations.
Histograms provide an overview of distance distributions, while confidence plots
summarize variability with intervals.
Examples
if (FALSE) { # \dontrun{
# Create sample data
data <- dplyr::tibble(
keypoint = rep(c("head", "arm", "leg", "torso"), each = 10),
x = rnorm(40, mean = 0, sd = 1),
y = rnorm(40, mean = 0, sd = 1)
)
# Plot histogram of distances
check_pose(data, reference_keypoint = "head", type = "histogram")
# Plot confidence intervals
check_pose(data, reference_keypoint = "head", type = "confidence")
} # }