
Plot action potential frequency curves for multiple treatments
Source:R/Plot-data.R
plot_AP_frequencies_multiple_treatments.Rd
This function allows you to generate a plot of action potential frequency (y-axis) for each current injection (x-axis), coloured by treatment. The linetype indicates which state the data belong to (a recording taken during the baseline or after a hormone or treatment).
Usage
plot_AP_frequencies_multiple_treatments(
data,
include_all_treatments = "yes",
list_of_treatments = NULL,
plot_category = 2,
included_sexes = "both",
male_label = "Male",
female_label = "Female",
treatment_colour_theme,
filename_suffix = "",
save_plot_png = "no",
ggplot_theme = patchclampplotteR_theme()
)
Arguments
- data
Action potential frequency data imported through
add_new_cells()
withdata_type == "AP_count"
- include_all_treatments
A character (
"yes"
or"no"
) specifying if the plot will include data from all treatments. If"no"
, you must specify a list of treatments inlist_of_treatments
.- list_of_treatments
A list of character values describing the treatments that will be in the plot. Defaults to
NULL
, since include_all_treatments is"yes"
by default.- 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.- included_sexes
A character value (
"both"
,"male"
or"female"
). Useful if you want to have a plot with data from one sex only. Defaults to"both"
. If you choose a single sex, the resulting plot will have"-males-only"
or"-females-only"
in the file name. WARNING!! If you choose"male"
or"female"
, you MUST ensure that thet_test_df
contains data that has been filtered to only include one sex. Otherwise, the significance stars will represent both sexes and it will be inaccurate.- male_label
A character value used to describe how males are encoded in the
sex
column of the dataframe used indata
. This MUST match the value for male data in thesex
column, and it must be consistent across data sheets. Defaults to"Male"
.- female_label
A character value used to describe how females are encoded in the
sex
column of the dataframe used indata
. This MUST match the value for female data in thesex
column, and it must be consistent across data sheets. This must be consistent in all data sheets. Defaults to"Female"
.- 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.
- filename_suffix
Optional character value to add a suffix to the filename of the .png file created with this plot. Could be useful if you have specified a custom list of treatments.
- save_plot_png
A character (
"yes"
or"no"
). If"yes"
, the plot will be saved as a .png usingggsave()
. The filepath depends on the current type, but they will all go in subfolders belowFigures/
in your project directory.- ggplot_theme
The name of a ggplot theme or your custom theme. This will be added as a layer to a ggplot object. The default is
patchclampplotteR_theme()
, but other valid entries includetheme_bw()
,theme_classic()
or the name of a custom ggplot theme stored as an object.