|
@@ -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,
|