Learn R Programming

Rtrack (version 1.0.7)

plot_path: Plot a path.

Description

Plots the path together with a representation of the arena. These plots are useful for diagnosis of classification problems.

Usage

plot_path(
  metrics,
  title = NULL,
  quadrants = FALSE,
  highlight.interpolated = TRUE,
  highlight.initial = TRUE,
  margins = c(0, 2, 4, 2),
  ...
)

Arguments

metrics

A metrics object from calculate_metrics.

title

An optional title for the plot. The default is to use the path name saved in the metrics object.

quadrants

Should the quadrants be marked on the plot. Default is FALSE

highlight.interpolated

Should interpolated sections of the path be highlighted (in grey). Default is TRUE.

highlight.initial

Should the initial section of the path be highlighted (in red). Default is TRUE. This is the section of the path equivalent in length to the distance between the start and the goal.

margins

The margins of the plot (see the option mar in par). The defaults should normally not need to be changed.

...

Additional arguments passed to the plot method in the SpatialPolygons-class to modify plot details.

Details

The path is plotted together with the context of the arena. The three concentric zones of the arena (the wall, outer wall and annulus) are drawn in progressively lighter shades of blue. The goal is a filled circle in orange and the old goal is drawn in grey. The direct path to goal is shown as a broken orange line and the 'approach corridor' (in transparent orange) is defined as a triangle fanning out from this line by 20 degrees either side. The path itself is drawn in black with grey sections corresponding to interpolated data (if highlight.interpolated = TRUE, the parameter interpolate = TRUE was set in read_path and there were missing data points in the raw track file). The initial path (the section of the path equivalent in length to the distance between the start and the goal) is drawn in red if highlight.initial = TRUE.

See Also

calculate_metrics, and also read_experiment for processing many tracks at once.

Examples

Run this code
require(Rtrack)
track_file <- system.file("extdata", "Track_1.csv", package = "Rtrack")
arena_description <- system.file("extdata", "Arena_SW.txt", package = "Rtrack")
arena <- read_arena(arena_description)
path <- read_path(track_file, arena, track.format = "ethovision.3.csv")
metrics <- calculate_metrics(path, arena)
plot_path(metrics)

Run the code above in your browser using DataLab