Skip to content

Visualize coupled categorical and continuous variables in a single plot (e.g., movement and speech state)

License

Notifications You must be signed in to change notification settings

a-paxton/plotting-coupled-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plotting coupled categorical and continuous time series data

This code plots coupled categorical and continuous time series in a single, elegant plot. It was originally created to visualize speech (categorical; speaking or silent) and movement (continuous; see Paxton & Dale, 2013, Behavior Research Methods) between two people engaged in conversation. The code includes sections to create color and greyscale plots.

Color Figure

alt text

Greyscale Figure

alt text

Adapting this code

The code as written assumes that the data are in long form -- in other words, with a single row per observation. If your data are in wide form, there are many useful R packages and tutorials to help you easily convert from wide to long form. Here are a few:

Note that any runs of the categorical variable that last only 1 sample are -- for graphing purposes only -- increased to a length of 1.1 samples in order to allow them to be plotted appropriately. (Without this increase, the start and end points for the categorical variables are identical, which would prevent the appropriate application of the shading.)

Citations

If you use or adapt this code, please cite our paper:

Tollefsen, D., Dale, R., & Paxton, A. (2013). Alignment, transactive memory, and collective cognitive systems. Review of Philosophy and Psychology, 4(1), 49-64.