Fix discrete x_var mapping

Tento commit je obsažen v:
2024-10-01 18:54:19 -04:00
rodič 1548dbf9c1
revize 462d6070bd

Zobrazit soubor

@@ -608,7 +608,8 @@ generate_scatter_plot <- function(plot, config) {
# Customize X-axis if specified
if (!is.null(config$x_breaks) && !is.null(config$x_labels) && !is.null(config$x_label)) {
if (is.factor(df[[config$x_var]]) || is.character(df[[config$x_var]])) {
# Check if x_var is factor or character (for discrete x-axis)
if (is.factor(plot$data[[config$x_var]]) || is.character(plot$data[[config$x_var]])) {
plot <- plot +
scale_x_discrete(
name = config$x_label,
@@ -624,6 +625,7 @@ generate_scatter_plot <- function(plot, config) {
)
}
}
# Set Y-axis limits if specified
if (!is.null(config$ylim_vals)) {
@@ -656,7 +658,8 @@ generate_boxplot <- function(plot, config) {
# Customize X-axis if specified
if (!is.null(config$x_breaks) && !is.null(config$x_labels) && !is.null(config$x_label)) {
if (is.factor(df[[config$x_var]]) || is.character(df[[config$x_var]])) {
# Check if x_var is factor or character (for discrete x-axis)
if (is.factor(plot$data[[config$x_var]]) || is.character(plot$data[[config$x_var]])) {
plot <- plot +
scale_x_discrete(
name = config$x_label,