Skip to contents

Generate Spike Raster Plot

Usage

plot_spike_raster(
  df,
  filename,
  id,
  time_of_stim,
  condition_names,
  auto_window = TRUE,
  auto_window_size = 10,
  auto_window_symmetric = FALSE,
  manual_condition_color = NULL,
  plot_conditions_only = TRUE
)

Arguments

df

Data Frame or Tibble with the following columns:

  • sweep

  • time_ms

  • condition

filename

Character, a single file name.

id

Character, experiment id.

time_of_stim

List, stimulus times in milliseconds.

condition_names

Character vector with condition titles.

auto_window

Boolean, automatically set the x-axis values based upon the first and last stimuli. Default is TRUE and will use the args auto_window_size and auto_window_symmetric to set the x-axis. If FALSE, the entire x-axis is plotted using the values c(0, NA).

auto_window_size

Integer, the amount of time in milliseconds to plot after the last stimulus. Default is 10 ms.

auto_window_symmetric

Boolean, will set the x-axis to plot auto_window_size before and after the first and last stimuli. Default is FALSE, and will start the x-axis at the first stimuli.

manual_condition_color

Character, vector of color values. Default is NULL, which will force arg auto_condition_color to TRUE, automatically generating color values.

plot_conditions_only

Boolean, Default is TRUE.

Value

ggplot object

See also

Examples

conditions <- c("control", "drug_1", "drug_2")
simple_df <-
  data.frame(
    sweep = rep(1:120, each = 3),
    time_ms = rep(c(280, 290, 300), times = 120),
    condition = rep(conditions, each = 120)
  )

plot_spike_raster(
  df = simple_df,
  filename = "example",
  id = "experiment_id",
  time_of_stim = c(278.18, 288.18, 298.18),
  condition_names = conditions,
  auto_window = TRUE,
  auto_window_size = 30,
  auto_window_symmetric = FALSE,
  plot_conditions_only = TRUE
)