plot_variance_comparison_data()
creates a connected plot with time as a
categorical variable (i.e. baseline/before and after) on the x-axis and the
variance measure on the y-axis. There are also lines
connecting the "before" data point to the "after" data point for each letter.
Usage
plot_variance_comparison_data(
data,
plot_category,
plot_treatment,
variance_measure = "cv",
baseline_interval = "t0to5",
baseline_label = "Baseline",
post_hormone_interval = "t20to25",
post_hormone_label = "Insulin",
large_axis_text = "no",
treatment_colour_theme,
theme_options,
save_plot_png = "no"
)
Arguments
- data
A dataframe generated using
make_variance_data()
.- 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.- 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.- variance_measure
A character value ("cv" or "VMR"). The variance measures can be either the inverse coefficient of variation squared (
variance_measure == "cv"
) or variance-to-mean ratio (variance_measure == "VMR"
).- baseline_interval
A character value indicating the name of the interval used as the baseline. Defaults to "t0to5", but can be changed. Make sure that this matches the baseline interval that you set in
make_normalized_EPSC_data()
.- baseline_label
A character value for the x-axis label applied to the pre-hormone state. Defaults to "Baseline".
- post_hormone_interval
A character value specifying the interval used for the data points after a hormone or protocol was applied. This must match the
post_hormone_interval
used inmake_variance_data()
.- post_hormone_label
A character value for x-axis label applied to the post-hormone or post-protocol state. Defaults to "Post-hormone" but you will likely change this to the hormone or protocol name.
- large_axis_text
A character ("yes" or "no"). If "yes", a ggplot theme layer will be applied which increases the axis text.
- 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.
- theme_options
A dataframe containing theme options. See sample_theme_options 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 ggplot object. If save_plot_png == "yes"
, it will also generate
a .png file exported to Figures/Evoked-currents/Variance-plots
. The plot
will be named in the form of
"Variance-comparison-category-plot_category
-plot_treatment
-variance_measure
.png".
An example filename is "Variance-comparison-category-2-Control-cv.png".
Details
The function will perform a paired wilcox test and add brackets with
significance stars through ggsignif::geom_signif()
.
This allows you to visually determine if a change in synaptic plasticity is due to a pre- or post-synaptic mechanism. For more information, please see Huijstee & Kessels (2020).
Examples
plot_variance_comparison_data(
data = sample_eEPSC_variance_df,
plot_category = 2,
plot_treatment = "Control",
variance_measure = "cv",
baseline_interval = "t0to5",
post_hormone_interval = "t20to25",
post_hormone_label = "Insulin",
large_axis_text = "no",
treatment_colour_theme = sample_treatment_names_and_colours,
theme_options = sample_theme_options
)