Note. This URL is fading fast.   

Visit our much-improved R plot annotation site here:  

https://reilly-lab.github.io/JamieR_PlotsExamples.html

 

 

TSRplot.jpeg

Here's one minute of continuous recording of pupillary dilation as the participant hears tones that shift in frequency at the markers. This nicely illustrates pupil spikes when change occurs.  Courtesy of Ally Dworetsky - our summer intern phenom. Script here -- includes interpolation, smoothing, and plotting parameters.

 

tanglegram

This monstrosity is called a tanglegram. It contrasts two hierarchical cluster dendrograms. In this case, the dendrograms represent English and Spanish clusters generated for translation equivalents among bilinguals (N=20) when rating the same set of words on color, size, emotion, distance, sound.  The 'tangles' show how meaning "remaps" when switching between languages.

I generated the clusters using K-means partitioning and colored the branches of the dendrogram by clusters. Here's the script.  Here are the data.

  

 

 

Using the facet wrap function for multiple plots

facet.png

Here we have multiple plots.  ggplot2 uses the facet_wrap function to arrange plots this way. The program breaks the data into subplots based on the factor a user specifies (in this case language).  These data are from a study we are on the verge of submitting. People force choice guessed whether aurally presented words in unfamiliar languages (e.g., Arabic, Dutch, Hebrew, Hindi, Korean, Russian) represented abstract or concrete concepts.  Most people were remarkably above chance even after we eliminated cognates from the mix. The shaded rectangle represents a range of approximate chance responding.

Annotated R code here

 

Lonely old bar graph

Here's one from an eyetracking study we just completed plotting average response latencies for the word and picture versions of the Pyramids and Palm Trees Test (objects) relative to the Kissing and Dancing Test (actions).    We eliminated the x and y top and right borders and scaled the y-axis minimum to .75.  R code here,  Dataframe here

 

Facet wrap scatterplots

Here are scatterplots for 14 dimensions arrayed using R's facet wrap function.  Here's the spreadsheet (in long form). Here's the R-code for plotting in ggplot2.

 

Interpolation and application of a moving average smoothing algorithm to pupil dilation data

So here's an interesting little time series plot. This reflects a the dilation of a single person's pupil over the course of a few seconds when a monitor rapidly flashes from white to black (the flash point is the orange dotted line). Here are the data and the R-script.  Our eyetracker samples at 120Hz, so there are blink trials that need be interpolated across.  The data off the tracker are jolty and noisy, so we applied a moving average smoothing algorithm of 8 places. This illustrates the time course of the pupil dilation nicely.  

 

 

Ribbon plot

Bonnie Zuckerman created this nice little ribbon plot demonstrating changes in pupil diameter as participants produced different semantic clusters over a one minute period in a verbal fluency task (i.e., Name as many animals as you can in one minute). She cleverly color-coded the time series by cluster (e.g., sea animals, house pets, etc). R Code here.

 

Manually passing a vector of standard errors to a simple bar chart... with some lazy Photoshopping

The trick with the position dodge function for error bars is that it must match the width of the bars specified in the geom_bar aesthetic (in this case .5). 

Here's the R-script for making this happen. 

 

 

 

 

 

 

 

Pupillary dilation/constriction for two time series alternating Dark-Bright

So impressive... Ally Dworetsky after one week in the lab  produced this nice li plot using ggplot. She measured her own pupil dilation dynamics over a minute as she viewed a black screen that switched at the 30 second point to yellow (causing a pupillary constriction). She also overlaid another of the summer intern's (Rena) time series for yellow to black with a switch at the 30s point (causing a pupillary dilation). Great work, Ally!  Download the script here

 

3d scatterplot of profanity versus taboo words in a semantic space constrained by valence, physiological arousal, and social acceptability

Here's a fun little 3d scatterplot using the scatterplot3d package.  This plot represents subjective ratings of emotional valence, social acceptability, and physiological arousal for a series of profane words relative to matched "taboo" body part words. There were a few tricky parts to executing this block of R-code (download here) and here are the data (download csv here). This plot represents the subjective ratings. To come is a plot reflecting peak pupil amplitudes when hearing profane vs. taboo but not profane words.