|
@@ -394,7 +394,7 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, grid_layout
|
|
}
|
|
}
|
|
|
|
|
|
# Start building the plot with aes_mapping
|
|
# Start building the plot with aes_mapping
|
|
- plot_base <- ggplot(df, aes_mapping) + theme_publication()
|
|
|
|
|
|
+ plot_base <- ggplot(df, aes_mapping)
|
|
|
|
|
|
# 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,
|
|
@@ -405,10 +405,9 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, grid_layout
|
|
plot_base # default case if no type matches
|
|
plot_base # default case if no type matches
|
|
)
|
|
)
|
|
|
|
|
|
- # Apply additional settings
|
|
|
|
- if (!is.null(config$legend_position)) {
|
|
|
|
- plot <- plot + theme(legend.position = config$legend_position)
|
|
|
|
- }
|
|
|
|
|
|
+ # Apply theme_publication with legend_position from config
|
|
|
|
+ legend_position <- if (!is.null(config$legend_position)) config$legend_position else "bottom"
|
|
|
|
+ plot <- plot + theme_publication(legend_position = legend_position)
|
|
|
|
|
|
# Add title and labels
|
|
# Add title and labels
|
|
if (!is.null(config$title)) {
|
|
if (!is.null(config$title)) {
|
|
@@ -615,11 +614,6 @@ generate_scatter_plot <- function(plot, config) {
|
|
plot <- plot + ggtitle(config$title)
|
|
plot <- plot + ggtitle(config$title)
|
|
}
|
|
}
|
|
|
|
|
|
- # Adjust Legend Position if specified
|
|
|
|
- if (!is.null(config$legend_position)) {
|
|
|
|
- plot <- plot + theme(legend.position = config$legend_position)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
return(plot)
|
|
return(plot)
|
|
}
|
|
}
|
|
|
|
|