mocap_plot_avatar: Add an avatar to a mocap plot or animation

View source: R/animation_functions.R

mocap_plot_avatarR Documentation

Add an avatar to a mocap plot or animation

Description

mocap_plot_avartar is called by the functions animate_global, animate_anatomical, and animate_movement functions after they have called mocap_plot_basic

Usage

mocap_plot_avatar(
  .plot,
  use_geom_point = TRUE,
  line_colored = TRUE,
  line_colored_alpha = 1,
  line_black = TRUE,
  line_black_alpha = 0.5,
  point = TRUE,
  point_alpha = 1,
  up_column = U
)

Arguments

.plot

A ggplot2 object containg mocap data in the mocapr format as it it created by mocap_plot_basic

use_geom_point

Defaults to TRUE. If TRUE, points in the animation will be created using ggplot2::geom_point(). If FALSE, points are created using ggforce::geom_circle(). This will ensure correct size-proportions of the points, and that no points are croped out of the animation. However, it comes at the prize of much longer rendering-times.

line_colored

Shall the joints be connected by colored lines? (TRUE or FALSE). Defaults to TRUE.

line_colored_alpha

The alpha value of the colored lines connecting the joint centers.

line_black

Shall the joints be connected by black lines? (TRUE or FALSE). Defaults to TRUE.

line_black_alpha

The alhpa value of the black lines connecting the joint centers.

point

Shall the joint centers be marked by points? (TRUE or FALSE). Defaults to TRUE.

point_alpha

The alpha of the points or circles that mark the joint centers.

up_column

The unquoted name of the column that contains the Up direction. Defaults to U, must be Y if the plots is prepared using animate_global.

Value

A ggplot2 object

Examples

df <- dplyr::filter(mocapr::mocapr_data, movement_nr == 1)
df <- dplyr::filter(df, frame %in% c(1, 50, 75, 100))
df <- mocapr::animate_global(df,
                             return_data = TRUE)
df <- mocap_plot_basic(df,
                 planes = c("X", "Y"), # Because the data comes from animate_global()
                 planes_in_rows_or_cols = "rows",
                 col_facets = frame
                 )
mocap_plot_avatar(df,
                  up_column = Y) # Because the data comes from animate_global()


steenharsted/mocapr documentation built on Feb. 1, 2024, 1:49 p.m.