plotXhead: Plot markers on symbolic head

View source: R/plotXhead.R

plotXheadR Documentation

Plot markers on symbolic head

Description

Plots a symbolic, standardized head with markers plotted at predefined starting points. To get meaningful plots, functions face2stdFace and centerCond first.

Usage

plotXhead(
  data,
  dataPos,
  title = "",
  overplot = FALSE,
  color = "black",
  alpha = 0.5,
  plotDataPos = FALSE,
  plotDotSize = 0.02
)

Arguments

data

Data-frame with a row sequence of standardized and centered x/y coordinates for each marker. Please use the functions face2stdFace and centerCond before plotting the data. Names of the data columns must end in '_x' for the x-axis and in '_y' for the y-axis.

dataPos

Named list of x/y starting position coordinates for each marker which should be plotted on the standardized face (e.g., dataPos = c(BL2 = c(-.3,.7), BR2 = c(.3,.7)), ...). Due to the tracking procedure in blender, the center of the coordinate system is the nose tip at x = 0, y = 0.

title

Default is no title.

overplot

If TRUE, only the marker plots, but no base graph is plotted. Default is FALSE.

color

Character vector of length one to define the color for plotting the Marker. Default is 'black'.

alpha

Alpha value / density for marker plots. 0 represents full transparency, whereas 1 represents full color. Default = .50. This may be adapted for plotting many participants

plotDataPos

If TRUE, for debugging puposes, the start position coordinates of dataPos are plotted. Default is FALSE.

plotDotSize

Size of the dots in cex. Default is 0.2.

Value

See vignette for example plots.

Author(s)

Rainer Alexandrowicz rainer.alexandrowicz@aau.at, Axel Zinkernagel zinkernagel@uni-wuppertal.de

Examples

colNames <- c("A7_x",  "A7_y",  "A8_x",  "A8_y",  
              "BL2_x", "BL2_y", "BL4_x", "BL4_y",  
              "BL5_x", "BL5_y", "BL7_x", "BL7_y",        
              "BR2_x", "BR2_y", "BR4_x", "BR4_y",  
              "BR5_x", "BR5_y", "BR7_x", "BR7_y",  
              "CL4_x", "CL4_y", "CL7_x", "CL7_y",        
              "CR4_x", "CR4_y", "CR7_x", "CR7_y",  
              "DL2_x", "DL2_y", "DR2_x", "DR2_y")

# Select data for plotting (selecting stimulus type and omit z-axis)
data_Subj_happy <- subset(dataStdFCen, subset = (dataStdFCen$Stimulustype == "posed_happy"), 
                         select = c("subject",colNames))
data_Subj_disgust <- subset(dataStdFCen, subset = (dataStdFCen$Stimulustype == "posed_disgust"), 
                           select = c("subject",colNames))

# Define the positions for the markers for the standardized face of x (-1,1) 
# and y (-1,1) size as named list
dataPos <- list(BL2 = c(-.3,.7), BR2 = c(.3,.7), 
               DL2 = c(-.7,.7), DR2 = c(.7,.7), 
               BL4 = c(-.2,.2), BR4 = c(.2,.2), 
               CL4 = c(-.5,.2), CR4 = c(.5,.2), 
               BL5 = c(-.2,-.1), BR5 = c(.2,-.1), 
               BL7 = c(-.2,-.6), BR7 = c(.2,-.6), 
               CL7 = c(-.3,-.7), CR7 = c(.3,-.7), 
               A7 = c(0,-.55), 
               A8 = c(0,-.8)) 

# For debugging purposes the marker names and start positions may also be plotted
plotXhead(data = data_Subj_happy[-1], dataPos = dataPos, 
         title = "All Subjects, happy", plotDataPos = TRUE)


axzinker/blenderFace documentation built on Feb. 27, 2024, 10:25 a.m.