|
@@ -394,10 +394,10 @@ generate_and_save_plots <- function(output_dir, file_name, plot_configs, grid_la
|
|
plot_base <- ggplot(df, aes_mapping)
|
|
plot_base <- ggplot(df, aes_mapping)
|
|
|
|
|
|
# Function to generate the plot
|
|
# Function to generate the plot
|
|
- generate_plot <- function(is_interactive) {
|
|
|
|
|
|
+ generate_plot <- function(interactive) {
|
|
# Use appropriate helper function based on plot type
|
|
# Use appropriate helper function based on plot type
|
|
plot <- switch(config$plot_type,
|
|
plot <- switch(config$plot_type,
|
|
- "scatter" = generate_scatter_plot(plot_base, config, is_interactive = is_interactive),
|
|
|
|
|
|
+ "scatter" = generate_scatter_plot(plot_base, config, is_interactive = interactive),
|
|
"box" = generate_box_plot(plot_base, config),
|
|
"box" = generate_box_plot(plot_base, config),
|
|
"density" = plot_base + geom_density(),
|
|
"density" = plot_base + geom_density(),
|
|
"bar" = plot_base + geom_bar(),
|
|
"bar" = plot_base + geom_bar(),
|
|
@@ -479,7 +479,7 @@ generate_scatter_plot <- function(plot, config, is_interactive = FALSE) {
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
- # Add the interactive `text` aesthetic if `is_interactive` is TRUE
|
|
|
|
|
|
+ # Add the interactive text aesthetic if `is_interactive` is TRUE
|
|
if (is_interactive) {
|
|
if (is_interactive) {
|
|
if (!is.null(config$delta_bg_point) && config$delta_bg_point) {
|
|
if (!is.null(config$delta_bg_point) && config$delta_bg_point) {
|
|
plot <- plot + geom_point(
|
|
plot <- plot + geom_point(
|
|
@@ -561,7 +561,7 @@ generate_scatter_plot <- function(plot, config, is_interactive = FALSE) {
|
|
plot <- plot + scale_y_continuous(limits = config$ylim_vals)
|
|
plot <- plot + scale_y_continuous(limits = config$ylim_vals)
|
|
}
|
|
}
|
|
|
|
|
|
- # Add annotations if provided
|
|
|
|
|
|
+ # Add annotations if specified
|
|
if (!is.null(config$annotations)) {
|
|
if (!is.null(config$annotations)) {
|
|
for (annotation in config$annotations) {
|
|
for (annotation in config$annotations) {
|
|
plot <- plot + annotate("text", x = annotation$x, y = annotation$y, label = annotation$label)
|
|
plot <- plot + annotate("text", x = annotation$x, y = annotation$y, label = annotation$label)
|