This function automatically generates a bar graph from observation or experimental data.
Utilisation
plot_xpbar(
self,
stats = NULL,
calculation_choices = NULL,
one_plot = TRUE,
text_stat = TRUE,
max_y = NULL,
bar_color = NULL,
bar_width = 0.7,
border_tnt = FALSE,
show_tnt = TRUE,
code_tnt = "TNT",
show_errorbar = TRUE,
show_data = TRUE,
short_names = TRUE,
factor_choice = NULL,
...
)Arguments
- self
An instance of the
UserDataR6 class- stats
character, the name of a stats list inside self$stats.
- calculation_choices
vector of character, choice(s) of calculation to plot. For example c("FA UN_BER_PC","IA UN_BER_PC")
- one_plot
boolean. If TRUE, all calculations are plot on an unique plot using fill argument, else each calculation is on a independent plot using factet
- text_stat
boolean. If TRUE, an annotation is added to the plot with the test done and its p-value
- max_y
Upper limit of the y axis. If NULL, automatic adjustment.
- bar_color
Bar fill colour.
- bar_width
bar width
- border_tnt
if true, the border color is set as red for TNT
- show_tnt
if false, TNT are removed from the graph
- code_tnt
a string to identify in TNT in the row of the dataframe by default "TNT"
- show_errorbar
display of error bars
- show_data
display data points
- short_names
to have shorter names for fill removing the last part of the string after the last space occurence
- factor_choice
character. Name of the factor to plot. If NULL only the first factor is used
- ...
other parameters for labs (title, x, y,fill)
Exemples
# example code
if (FALSE) { # \dontrun{
# Before creating the graph, it is necessary to have compiled the statistics.
prepare_data(mydata, df = "data_G1")
test_stats(mydata, prep_data = "prp1_data_G1")
# 3. Generating the barplot
plot_xpbar(mydata, stats = "prp1_data_G1")
# Custom example with data points and error bars
plot_xpbar(mydata,
stats = "prp1_data_G1",
show_data = TRUE,
show_errorbar = TRUE,
bar_color = c("#d9f0d3", "#1b7837"),
)
} # }
