mt_plot_per_trajectory creates a PDF file with separate plots per trajectory. This PDF can be used for inspecting individual trajectories. Note that plotting all trajectories can be time-consuming, especially for raw trajectories. If the appropriate x and y arguments are inserted, this function can also be used for plotting velocity and acceleration profiles.

mt_plot_per_trajectory(
  file,
  data,
  use = "trajectories",
  x = "xpos",
  y = "ypos",
  xlim = NULL,
  ylim = NULL,
  axes_exact = FALSE,
  points = FALSE,
  rect = NULL,
  color = "black",
  fill = NA,
  verbose = FALSE,
  ...
)

Arguments

file

a character string specifying the name of the PDF file. Passed on to pdf.

data

a mousetrap data object created using one of the mt_import functions (see mt_example for details). Alternatively, a trajectory array can be provided directly (in this case use will be ignored).

use

a character string specifying which trajectories should be plotted. The corresponding trajectories are selected from data using data[[use]]. Usually, this value corresponds to either "trajectories", "tn_trajectories" or "av_trajectories", depending on whether the raw, time-normalized or averaged trajectories should be plotted.

x

a character string specifying which dimension in the trajectory array should be displayed on the x-axis (defaults to xpos).

y

a character string specifying which dimension in the trajectory array should be displayed on the y-axis (defaults to ypos).

xlim

optional argument specifying the limits for the x axis (passed on to coord_cartesian). If not specified (the default), sensible axis limits will be computed.

ylim

optional argument specifying the limits for the y axis (passed on to coord_cartesian). If not specified (the default), sensible axis limits will be computed.

axes_exact

logical. If TRUE, axes will be set without offset exactly at the limits of the x and y axes (which can be specified using xlim and ylim]).

points

logical. If TRUE, points will be added to the plot using geom_point.

rect

optional argument passed on to mt_plot_add_rect. If specified, rectangles (usually representing the response buttons) will be plotted for each trajectory plot.

color

optional argument passed on to mt_plot_add_rect. Only relevant if rect is specified.

fill

optional argument passed on to mt_plot_add_rect. Only relevant if rect is specified.

verbose

logical indicating whether function should report its progress.

...

additional arguments passed on to pdf.

Details

mt_plot_per_trajectory creates a PDF using pdf. Next, it plots all trajectories individually using mt_plot. Every plot is labeled using the rownames of the trajectories.

See also

mt_plot for plotting trajectory data.

Author

Pascal J. Kieslich

Felix Henninger

Examples

if (FALSE) {
mt_plot_per_trajectory(mt_example,
  file="trajectories.pdf",
  use="trajectories")
}