If you have an agent (or multiple agents) that can choose between two mutually exclusive states (1 and 2), then its preference for either state can be plotted with achoice plot.

I just made up the name…

If the agent has equal probability -at any given time- to be in state 1 or 2, you can plot the deviation from the chance level (i.e. 50%) of being in either states using a combination of color and location (e.g. above Vs below the x axis).

## The axis

The Y axis represents the % time spent in state 1 (above X axis) and state 2 (below X axis). In this case I have plotted a group performance (see standard error bars).

The X axis is used to plot the minute by minute performance/choice.

## Example plots

How different behavioral patterns look like in the choice plot: [A] Random choice between states 1 and 2, the agents spend an equal amount of time in both states. [B] Most of the time is spent in state 2 (below x axis). [C] The initial preference for state 2 is lost around the 6th minute of the session. [D] The opposite of panel C.

What I really like about this plot is its flexibility. This is how a good plot should be: it nicely bends to your will! I want a plot that can be easily customized to emphasize the story I want to tell. For example,

• You can choose the location of the states (above or below the x axis) to emphasize a rising or descending trend (see panels C and D, respectively).
• Deviations from the chance level are immediately visible thanks to the color on gray background (see panels A and B)

There are few things that I don’t like about this plot (mostly related to its implementation – i.e. the code in R):

• On the Y axis the % time for state 2 is reported as negative (this is a quick & dirty hack-trick to plot the state in the reverse direction). However, this can be easily fixed.
• The code is rather verbose and WET (… if WET is the oppposite of DRY – Do Not Repeat Yourself?) most of the code could use a refactoring to get rid of very similar instructions – basically everything in the for loop (lines 11~21).
• When plotting group performances the graph may be a bit awkawrd because the single bars do not add up to 100% – *see note at the end of the post.
• The managing of signs (thresholds, direction and +/-) may be a bit convoluted, but it makes sense if read by a human being …

## The code (made in R)

This plot was generated (with random data*) in R – see code below.