This function enables you to create a scatterplot of raw evoked (or
spontaneous) current amplitude over time in minutes. The plot title will be
pulled from the recording ID (the letter
column in the raw data), and the
subtitle will include the sex and treatment. The plot will also contain a
horizontal line annotation displayed over the time region where a hormone was
applied. If a high-frequency stimulation (HFS) protocol is used, the plot
will display an arrow with the label "HFS" to indicate the time when HFS was
applied.
Usage
plot_raw_current_data(
data,
plot_treatment = "Control",
plot_category = 2,
current_type = "eEPSC",
parameter = "P1",
pruned = "no",
hormone_added = "Insulin",
hormone_or_HFS_start_time = 5,
hormone_end_time = NULL,
theme_options,
treatment_colour_theme,
save_plot_png = "no"
)
Arguments
- data
A dataframe containing the raw evoked current data generated from
make_normalized_EPSC_data()
.- plot_treatment
A character value specifying the treatment you would like to plot (e.g. "Control").
plot_treatment
represents antagonists that were present on the brain slice, or the animals were fasted, etc.- plot_category
A numeric value specifying the category, which can be used to differentiate different protocol types. In the sample dataset for this package,
plot_category == 2
represents experiments where insulin was applied continuously after a 5-minute baseline period.- current_type
A character describing the current type. Allowed values are "eEPSC" or "sEPSC".
- parameter
A character value specifying the parameter to be plotted on the y-axis. For evoked currents (
current_type = "eEPSC"
), the available parameters are "P1", "P1_transformed", "mean_P1" and "PPR". Note: If you select "mean_P1", you must set thepruned
argument to "yes". For spontaneous currents (current_type = "sEPSC"
), the available parameters are "amplitude" or "frequency".- pruned
A character value ("yes" or "no") specifying if the data are pruned. This is only used for evoked current data where
parameter = "mean_P1
. The plot will then present the data as means with error bars.- hormone_added
A character value that will be used as the label over the line annotating the period when a hormone was applied. Examples include "500 nM Insulin", "CCK + Leptin", and "Insulin". If you applied a high-frequency stimulation (HFS) protocol instead, write "HFS", and an annotation arrow will be added instead.
- hormone_or_HFS_start_time
A numeric value indicating the time (in minutes) when a hormone was added or when HFS was applied. This will set the annotation line start point.
- hormone_end_time
A numeric value indicating the time (in minutes) when a hormone stopped being applied, such as for a washout experiment.
- theme_options
A dataframe containing theme options. See sample_theme_options for an example of what this dataframe should look like.
- treatment_colour_theme
A dataframe containing treatment names and their associated colours as hex values. See sample_treatment_names_and_colours for an example of what this dataframe should look like.
- save_plot_png
A character ("yes" or "no"). If "yes", the plot will be saved as a .png using ggsave. The filepath depends on the current type, but they will all go in subfolders below Figures/ in your project directory.
Value
A list of ggplot objects, where each list element is a scatterplot
of one recording. If save_plot_png == "yes"
, it will also generate a .png
file from each ggplot element in the list. The figures will be exported to
Figures/Evoked-currents/Output-individual-plots
or
Figures/Spontaneous-currents/Output-individual-plots
, depending on the
current_type
. The .png filename will contain the letter
. If the data
are pruned, the filename will also include _pruned
in the filename. If
the data are normalized (parameter == "P1_transformed
), the title will
include _normalized
in the filename. Example filenames include "A.png",
"A_normalized", and "A_pruned.png".
Examples
plot_raw_current_data(
data = sample_raw_eEPSC_df,
plot_treatment = "Control",
plot_category = 2,
current_type = "eEPSC",
parameter = "P1",
pruned = "no",
hormone_added = "Insulin",
hormone_or_HFS_start_time = 5,
theme_options = sample_theme_options,
treatment_colour_theme = sample_treatment_names_and_colours,
save_plot_png = "no"
)
#> $AO
#>
#> $AZ
#>
#> $BN
#>
#> $L
#>