Skip to contents

plot_spontaneous_current_trace() generates a plot of raw current amplitude over time for a specified sweep from an ABF file. It requires a dataframe generated from raw .abf data with import_ABF_file(). The function returns a ggplot object with an optional scale bar.

Usage

plot_spontaneous_current_trace(
  file,
  plot_colour,
  include_scale_bar = "yes",
  plot_episode = "epi1",
  scale_bar_x_start = 1.25,
  scale_bar_x_length = 0.5,
  scale_bar_y_start = 15,
  scale_bar_y_length = 20,
  plot_x_min = 1,
  plot_x_max = 5,
  plot_y_min = -100,
  plot_y_max = 35,
  save_plot_pngs = "no"
)

Arguments

file

A dataframe containing at least these columns: time, episode, current, voltage, time_sec. An easy way to obtain this is by importing a raw .abf file through the import_ABF_file() function.

plot_colour

A character value naming the colour of the plot.

include_scale_bar

A character value that determines if a scale bar will be added to the plot. Allowed values are "yes" and "no".

plot_episode

A character value describing the sweep (e.g. epi1) that will be used for the plot.

scale_bar_x_start

A numeric value describing the x-axis position of the scale bar.

scale_bar_x_length

A numeric value describing the horizontal span (in seconds) of the scale bar. This will automatically be converted and displayed in milliseconds.

scale_bar_y_start

A numeric value describing the y-axis position of the scale bar.

scale_bar_y_length

A numeric value describing the vertical span (in pA) of the scale bar.

plot_x_min

A numeric value describing the minimum value on the x-axis (in seconds).

plot_x_max

A numeric value describing the maximum value on the x-axis (in seconds).

plot_y_min

A numeric value describing the minimum value on the y-axis (in pA).

plot_y_max

A numeric value describing the maximum value on the y-axis (in pA).

save_plot_pngs

A character ("yes" or "no") defining if the plot should be saved as a PNG through ggplot::ggsave().

Value

A ggplot object. If save_plot_PNGs is defined as "yes", it will also generate a .png file in the folder Figures/Spontaneous-currents/Representative-Traces relative to the project directory.

Examples

plot_spontaneous_current_trace(
  file = sample_abf_file,
  plot_colour = "#6600cc",
  include_scale_bar = "yes",
  plot_episode = "epi1",
  scale_bar_x_length = 1,
  scale_bar_y_length = 10,
  plot_x_min = 1,
  plot_x_max = 3
)