View source: R/flex_accuracy_diff2.R
flex_accuracy_diff2 | R Documentation |
This function generates detailed interactive or static visualizations comparing the accuracy of two methods across different traits. It uses ggplot2 and plotly for rendering the plots.
flex_accuracy_diff2(
accuracy_diff_data,
user_colors = c("lightblue", "lightpink"),
interactive = TRUE,
user_geom_bar = geom_bar(stat = "identity", position = position_dodge(0.5), width =
0.4),
user_geom_point = geom_point(aes(x = trait, y = R2diff), color = "black", size = 2),
user_accuracy_geom_errorbar = geom_errorbar(aes(ymin = lower_limit_R2, ymax =
upper_limit_R2), color = "black", width = 0.1, position = position_dodge(0.5)),
user_accuracy_diff_geom_errorbar = geom_errorbar(width = 0.05, color = "black"),
user_geom_text = geom_text(aes(x = trait, y = ymax + 0.1, label = p_value), hjust =
0.5, size = 3.5),
user_ylim_accuracy = ylim(0, 1),
user_ylim_accuracy_difference = ylim(0, 1),
user_accuracy_labs = labs(x = "", y = "R2", title = "R2 values"),
user_accuracy_diff_labs = labs(x = "", y = "Difference", title =
"Difference between R2"),
user_accuracy_theme = theme_minimal(),
user_accuracy_diff_theme = theme_minimal(),
user_accuracy_theme_specs = theme(legend.position = c(0.85, 0.85)),
user_accuracy_diff_theme_specs = theme(axis.title.x = element_blank(), axis.text.x =
element_blank(), axis.ticks.x = element_blank(), plot.margin = unit(c(1, 1, 1, 1),
"lines"))
)
accuracy_diff_data |
A data frame containing nine columns and at least
two rows: |
user_colors |
A character vector of length 2 specifying colors for the two methods in the bar plot. |
interactive |
Logical, if |
user_geom_bar |
A ggplot2 geom_bar object for customizing the bar plot appearance. Accepts parameters like stat, position, and width to control the visual properties of the bars. |
user_geom_point |
A ggplot2 geom_point object for customizing the point plot appearance. This includes settings for color and size of points which represent the differences in accuracy. |
user_accuracy_geom_errorbar |
A ggplot2 geom_errorbar object for customizing the error bars in the accuracy plot. This involves setting parameters like color, width, and position to visually modify how error bars are displayed. |
user_accuracy_diff_geom_errorbar |
A ggplot2 geom_errorbar object for customizing the error bars in the accuracy difference plot. Similar to user_accuracy_geom_errorbar, but typically used to emphasize differences between methods. |
user_geom_text |
A ggplot2 geom_text object for adding text annotations to the plots. This can include parameters for positioning, size, and the label content, often used to display statistical significance or other annotations. |
user_ylim_accuracy |
A ggplot2 ylim function call for setting the y-axis limits in the accuracy plot. This helps in controlling the scale of the plot to better fit the data presentation. |
user_ylim_accuracy_difference |
A ggplot2 ylim function call for setting the y-axis limits in the accuracy difference plot. Useful for maintaining consistent visual scales across related plots. |
user_accuracy_labs |
A ggplot2 labs function call for setting labels and titles in the accuracy plot. This includes parameters to set the x-axis label, y-axis label, and the main title of the plot. |
user_accuracy_diff_labs |
A ggplot2 labs function call for setting labels and titles in the accuracy difference plot. Useful for distinguishing between different plots and providing clear, informative titles and labels. |
user_accuracy_theme |
A ggplot2 theme object for applying styling themes to the accuracy plot. This parameter can be used to apply a predefined theme or customize aspects like text, background, and grid lines. |
user_accuracy_diff_theme |
A ggplot2 theme object for applying styling themes to the accuracy difference plot. Allows for consistent or contrasting styles between different types of visualizations in the package. |
user_accuracy_theme_specs |
Additional ggplot2 theme modifications specifically for the accuracy plot. This can involve finer control over elements like legend position and plot margins. |
user_accuracy_diff_theme_specs |
Additional ggplot2 theme modifications specifically for the accuracy difference plot. Tailored to enhance or modify specific aspects of the plot's appearance beyond the base theme settings. |
Either a ggplot or plotly object depending on the interactive
argument.
library(ggplot2)
library(plotly)
library(dplyr)
library(nortest)
library(ggforce)
library(reshape2)
library(gridExtra)
library(grid)
library(cowplot)
flex_accuracy_diff2(example_data6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.