Learn R Programming

Rtrack (version 1.0.7)

plot_strategies: Plot water maze strategies.

Description

Plots the strategy usage for all groups.

Usage

plot_strategies(
  strategies,
  experiment,
  factor = NA,
  exclude.probe = FALSE,
  boundaries = NA,
  legend = TRUE,
  x.axis = "Day",
  titles = TRUE,
  screen = FALSE,
  margins = c(5, 4, 4, 8),
  ...
)

Value

This function invisibly returns a named list for each level of the supplied factor. Each element of this list holds a matrix of plotting values for every strategy / trial. These values are cumulative counts of strategy use for all subjects at each trial. They specify the uppermost points of a layered series of polygons and could be used to build a customised plot if desired.

Arguments

strategies

The strategy calls as returned from call_strategy or similar.

experiment

The experiment object as returned from read_experiment.

factor

The factor by which the data should be grouped.

exclude.probe

Should data from probe trials be excluded (see Details).

boundaries

Where should the boundaries between arena types be drawn (see Details).

legend

Should a legend be drawn. Default is to add a legend to the plot.

x.axis

The scale of the x axis. Default, "Day", is to add a labelled axis with tick marks at each day. If this parameter is set to "Trial", then tick marks are added for each trial. If set to "none", then no x axis will be drawn.

titles

Should titles be drawn. Default is to add a main title and titles for the x and y axes. These can be supressed and added afterwards (using title). This might be helpful for localising to a different language for example.

screen

Should multiple plots be drawn to one page. Default is FALSE. This can be useful for advanced layout using split.screen.

margins

The margins of the plot (see the option mar in par). The defaults should usually be fine, but they can be overridden if, for example, factor names are very long.

...

Other parameters passed to segments to control the plotted lines.

Details

The strategies returned by read_experiment can be shown in a summary plot. In these plots, the fraction of subjects utilising a particular strategy is shown for each day/trial. If a factor is provided, then one plot will be made for each level of the factor. To view data for mutliple factors, they will need to be collapsed into one composite factor for plotting using this function. If probe trials were used, these can be ignored (not plotted) as the strategy use in the absence of the goal will be somewhat different. For this to work, a column named 'Probe' must be present in the experiment description spreadsheet and must contain the value 'TRUE' for each probe trial.

Boundaries are drawn (as broken vertical lines) between different arena types (for example between acquisition and goal reversal phases of a Morris water maze experiment). By default, these are added between each unique arena definition. If this is not appropriate, then this can be overridden by providing the boundaries parameter with a data.frame with two columns 'day' and 'trial'. Multiple boundaries can be defined by entering the day and trial index into rows of this table. Use boundaries = NULL to suppress boundary lines altogether.

Examples

Run this code
# This function relies on data too large to include in the package.
# For a worked example, please see the vignette "Rtrack MWM analysis".

Run the code above in your browser using DataLab