Handle dynamic mean_point color
This commit is contained in:
@@ -661,7 +661,8 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width
|
|||||||
ymin = .data[[y_mean_col]] - .data[[y_sd_col]],
|
ymin = .data[[y_mean_col]] - .data[[y_sd_col]],
|
||||||
ymax = .data[[y_mean_col]] + .data[[y_sd_col]],
|
ymax = .data[[y_mean_col]] + .data[[y_sd_col]],
|
||||||
color = .data[[config$color_var]]
|
color = .data[[config$color_var]]
|
||||||
)
|
),
|
||||||
|
linewidth = 0.1
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
# If a fixed error bar color is set, use it outside aes
|
# If a fixed error bar color is set, use it outside aes
|
||||||
@@ -671,20 +672,34 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width
|
|||||||
ymin = .data[[y_mean_col]] - .data[[y_sd_col]],
|
ymin = .data[[y_mean_col]] - .data[[y_sd_col]],
|
||||||
ymax = .data[[y_mean_col]] + .data[[y_sd_col]]
|
ymax = .data[[y_mean_col]] + .data[[y_sd_col]]
|
||||||
),
|
),
|
||||||
color = config$error_bar_params$color
|
color = config$error_bar_params$color,
|
||||||
|
linewidth = 0.1
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add the center point if the option is provided
|
# Add the center point if the option is provided
|
||||||
if (!is.null(config$error_bar_params$center_point)) {
|
if (!is.null(config$error_bar_params$mean_point) && config$error_bar_params$mean_point) {
|
||||||
plot <- plot + geom_point(aes(
|
if (!is.null(config$color_var) && is.null(config$error_bar_params$color)) {
|
||||||
|
plot <- plot + geom_point(
|
||||||
|
aes(
|
||||||
x = .data[[config$x_var]],
|
x = .data[[config$x_var]],
|
||||||
y = .data[[y_mean_col]]),
|
y = .data[[y_mean_col]],
|
||||||
|
color = .data[[config$color_var]]
|
||||||
|
),
|
||||||
|
shape = 16
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
plot <- plot + geom_point(
|
||||||
|
aes(
|
||||||
|
x = .data[[config$x_var]],
|
||||||
|
y = .data[[y_mean_col]]
|
||||||
|
),
|
||||||
color = config$error_bar_params$color,
|
color = config$error_bar_params$color,
|
||||||
shape = 16
|
shape = 16
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Convert ggplot to plotly for interactive version
|
# Convert ggplot to plotly for interactive version
|
||||||
plotly_plot <- suppressWarnings(plotly::ggplotly(plot))
|
plotly_plot <- suppressWarnings(plotly::ggplotly(plot))
|
||||||
@@ -946,7 +961,7 @@ generate_interaction_plot_configs <- function(df_summary, df_interaction, type)
|
|||||||
plot_config$error_bar <- TRUE
|
plot_config$error_bar <- TRUE
|
||||||
plot_config$error_bar_params <- list(
|
plot_config$error_bar_params <- list(
|
||||||
color = "red",
|
color = "red",
|
||||||
center_point = TRUE,
|
mean_point = TRUE,
|
||||||
y_mean_col = paste0("mean_mean_", var),
|
y_mean_col = paste0("mean_mean_", var),
|
||||||
y_sd_col = paste0("mean_sd_", var)
|
y_sd_col = paste0("mean_sd_", var)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user