分享一個ggplot2繪制人體結(jié)構(gòu)圖的小例子,喜歡的小伙伴可以關(guān)注個人公眾號R語言數(shù)據(jù)分析指南,持續(xù)分享更多優(yōu)質(zhì)資源,在此先行拜謝了?。?!
bdgramR簡介
一個R包,提供原始的x,y坐標在R中繪制人體圖。這種類型的可視化通常用于運動科學,力量與狀況和其他與健康有關(guān)的區(qū)域,以報告有關(guān)肌肉/關(guān)節(jié)相關(guān)指標(例如肌肉)的視覺信息酸痛,肌肉活化,力量,溫度等...
安裝
install.packages("devtools")
devtools::install_github("josedv82/bdgramR")
使用方法
獲取可用于所有身體圖類型的列表 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
使用glimpse_models()直觀地探索了每個體圖的模樣
library(bdgramR)
glimpse_models(data = data, color = "brown", fill = "orange")

獲取您希望與之配合使用的人體圖的原始x / y坐標 bdgramr()
library(bdgramR)
dat <- bdgramr(data = data, model = "original_male")
head(dat)
> 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
ggplot2添加圖層進一步自定義可視化:
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))
plot

原文鏈接:https://links.jianshu.com/go?to=https%3A%2F%2Fmp.weixin.qq.com%2Fs%2FpGpUYiVzxlK1Aq2sb_8x6Q