Plots a density map ("heatmap") of the path.

plot_density(
  metrics,
  title = NULL,
  col = (grDevices::colorRampPalette(c("#FCFBFD", "#9E9AC8", "#3F007D")))(256),
  legend = TRUE,
  feature.col = "black",
  feature.lwd = NA,
  lwd = 1,
  resolution = 600,
  margins = c(0, 0, 3, 0)
)

Arguments

metrics

An rtrack_metrics object from calculate_metrics.

title

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

col

Colours for the density map. These can be provided as any vector of colours. The recommended (and default) approach is to use colorRampPalette. The default colouring is a simple white-to-blue scale.

legend

Should a colour scale legend be drawn? Default is TRUE.

feature.col

The colour to plot outlines of arena features (goals, objects, aversive zone etc., depending on the arena type). Black by default, but it may be useful to change this if a very dark colour scheme is used.

feature.lwd

The width of the lines used to plot the feature outlines. By default this is drawn heavier to make them stand out.

lwd

The thickness of the lines used to draw the arena. Default is 1.

resolution

The resolution of the heatmap in pixels. The default is 600 x 600.

margins

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

Examples

require(Rtrack)
track_file <- system.file("extdata", "Track_1.tab", package = "Rtrack")
arena_description <- system.file("extdata", "Arena.txt", package = "Rtrack")
arena <- read_arena(arena_description)
path <- read_path(track_file, arena, track.format = "raw.tab")
metrics <- calculate_metrics(path, arena)
plot_density(metrics)