mocap_plot_basic: Set up basic ggplot2 plotting structure for mocapr plots and...

View source: R/animation_functions.R

mocap_plot_basicR Documentation

Set up basic ggplot2 plotting structure for mocapr plots and animations

Description

mocap_plot_basic is caled by the functions animate_global, animate_anatomical, and animate_movement functions to set up the basic structure of the plots and animations

Usage

mocap_plot_basic(
  .data,
  planes = c("R", "F"),
  planes_in_rows_or_cols = c("cols"),
  row_facets = NULL,
  col_facets = NULL,
  subject = NULL,
  remove_facet_labels = TRUE,
  remove_grid = TRUE
)

Arguments

.data

A tibble containg mocap data in the mocapr format.

planes

What planes should be included in the final plot/animation? defaults to c("R", "F"), use c("X", "Z") if you are using global coordinates.

planes_in_rows_or_cols

Facet the chosen planes in either rows or columns. Must be one of c("rows", "cols"). Defaults to "cols".

row_facets

Make additional row-facets in the animation using a given variable. Defaults to NULL.

col_facets

Make additional column-facets in the animation using a given variable. Defaults to NULL.

subject

Column that contains subject ID. Is only needed if more than one subject is present in the same frame.

remove_facet_labels

Remove the facet labels. Defaults to TRUE.

remove_grid

Remove the grid lines. Defaults to TRUE

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)
mocap_plot_basic(df,
                 planes = c("X", "Y"), # Because the data comes from animate_global()
                 planes_in_rows_or_cols = "rows",
                 col_facets = frame)

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