Mask R-squared annotation

This commit is contained in:
2024-10-05 05:30:00 -04:00
parent 274eec2814
commit e6f5aab81f

View File

@@ -703,6 +703,16 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width
# Add the center point if the option is provided
if (!is.null(config$error_bar_params$mean_point) && config$error_bar_params$mean_point) {
if (!is.null(config$color_var) && is.null(config$error_bar_params$color)) {
plot <- plot + geom_point(
aes(
x = .data[[config$x_var]],
y = .data[[y_mean_col]],
color = .data[[config$color_var]]
),
shape = 16
)
} else {
plot <- plot + geom_point(
aes(
x = .data[[config$x_var]],
@@ -713,6 +723,7 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width
)
}
}
}
# Convert ggplot to plotly for interactive version
plotly_plot <- suppressWarnings(plotly::ggplotly(plot))
@@ -1068,7 +1079,7 @@ generate_interaction_plot_configs <- function(df_summary, df_interaction, type)
annotations = list(
list(x = 1, y = y_limits[2] - 0.1 * y_span, label = paste(" ZShift =", round(Z_Shift_value, 2))),
list(x = 1, y = y_limits[2] - 0.2 * y_span, label = paste(" lm ZScore =", round(Z_lm_value, 2))),
list(x = 1, y = y_limits[2] - 0.3 * y_span, label = paste(" R-squared =", round(R_squared_value, 2))),
# list(x = 1, y = y_limits[2] - 0.3 * y_span, label = paste(" R-squared =", round(R_squared_value, 2))),
list(x = 1, y = y_limits[1] + 0.1 * y_span, label = paste("NG =", NG_value)),
list(x = 1, y = y_limits[1] + 0.05 * y_span, label = paste("DB =", DB_value)),
list(x = 1, y = y_limits[1], label = paste("SM =", SM_value))