Skip to contents

MuscleTernary provides tools for visualizing 3D muscle force resultants in ternary space. From muscle origin and insertion coordinates — optionally with force or moment data and any number of categorical or continuous variables — it computes the relative x, y, z proportions of each muscle’s line of action and plots them on a ternary diagram via extensions of the ggtern package.

The package also:

Installation

  • Install pak (if you haven’t already): install.packages("pak").
  • Install MuscleTernary from GitHub: pak::pak("Middleton-Lab/MuscleTernary").

Quick start

library(MuscleTernary)
library(ggtern)

# Muscle origin/insertion coordinates, with side and force
coords <- readr::read_csv(
  system.file("extdata", "AL_008_data.csv", package = "MuscleTernary"),
  show_col_types = FALSE
)

# Convert 3D resultant vectors to ternary (x, y, z) proportions
tern <- coords_to_ternary(coords, grouping = c("muscle", "side"))

# Plot in ternary space
ggtern(tern, aes(x, y, z, color = muscle)) +
  geom_point(size = 3) +
  muscle_color_map()

See ?MuscleTernary, demo(ternary_plot), and the package vignettes (browseVignettes("MuscleTernary")) for fuller workflows, including Xfiber data, animation, and Maya MEL export.