Skip to content

Latest commit

 

History

History
133 lines (82 loc) · 3.89 KB

README.md

File metadata and controls

133 lines (82 loc) · 3.89 KB

License: MIT Lifecycle: experimental

{bdgramR}

A collection of body diagram visualizations in R


1) What is {bdgramR}?

An R package that provides raw x,y coordinates to draw human body diagrams in R. This type of visualizations are commonly used in Sport Science, Strength and Conditioning and other health related areas to report visual information about muscle / joint related metrics such as muscle soreness, muscle activation, strength, temperature, etc...

For more information on how body diagrams can be used in R please visit this article and this github repo where I wrote about some ideas to add visualizations to reports and integrate with other packages for more functionality.

2) Installation

#Install from CRAN 
#Not currently on CRAN

  
#Install the development version from GitHub  
install.packages("devtools")
devtools::install_github("josedv82/bdgramR")

3) Usage

{bdgramR} is a small package and provides only a handful on functions:

Get a list of all the body diagram types available with model_types()
library(bdgramR)

model_types(data = data)

# A tibble: 9 x 1
  Model             
  <fct>             
1 futuristic_male   
2 original_male     
3 original_female   
4 thermohuman_male  
5 thermohuman_female
6 athletesr         
7 basic_female      
8 basic_male        
9 multi_view_male  

Use glimpse_models() to visually explore what each body diagram looks like.
library(bdgramR)

glimpse_models(data = data, color = "brown", fill = "orange")

Get raw x/y coordinates of the body diagram you wish to use with bdgramr()

library(bdgramR)

dat <- bdgramr(data = data, model = "original_male")

head(dat)

 Id      View       Part  Group Muscle  Side   x   y
1  1 Posterior Lower_Body Calves Soleus Right 739 723
2  1  Anterior Lower_Body Calves Soleus Right 739 724
3  1  Anterior Lower_Body Calves Soleus Right 740 724
4  1  Anterior Lower_Body Calves Soleus Right 740 725
5  1  Anterior Lower_Body Calves Soleus Right 741 725
6  1  Anterior Lower_Body Calves Soleus Right 741 726

Finally, you can use geom_bdgramr() within your ggplot code.


library(bdgramR)
library(ggplot2)

dat <- bdgramr(data = data, model = "original_male")

ggplot(data = dat, aes(x,y, group = Id)) +
  geom_bdgramr()

Like with any other ggplot, users can add more layers to further customise the visualization. For example:

library(bdgramR)
library(ggplot2)

dat <- bdgramr(data = data, model = "original_male")

plot <- ggplot(data = dat, aes(x,y, group = Id)) +
  geom_bdgramr(color = "cyan", aes(fill = Muscle)) +
  ggtitle("BdygramR: original_male diagram")
  
plot

4) Acknowledgment

I'd like to credit two known sources of inspiration for some of the body diagrams in this package.

Two of the available body diagrams are inspired on athleteSR and Thermohuman as the body diagrams they use on their software are very well designed. In this case, I have named them after the actual software.

5) Future Development

{bdgramR} is a small package and likely not much more development needed besides adding some more body diagram types. However, the package is currently under development and I welcome any feedback to improve or issues you may come across when using it.