From 8f679dead90b51729aab85d7952c4c9bfbed4e97 Mon Sep 17 00:00:00 2001 From: ishaan-arora-1 Date: Sat, 14 Mar 2026 19:57:40 +0530 Subject: [PATCH] Replace superseded coord_flip() with swapped aesthetics in ppc_error_scatter_avg (#476) coord_flip() is marked [Superseded] in ggplot2. Replaced with direct aesthetic swapping (aes(x = y_obs, y = value)) and corresponding label swaps in ppc_error_scatter_avg() and ppc_error_scatter_avg_vs_x(). --- R/ppc-errors.R | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/R/ppc-errors.R b/R/ppc-errors.R index f0012f24..a10f280e 100644 --- a/R/ppc-errors.R +++ b/R/ppc-errors.R @@ -243,22 +243,22 @@ ppc_error_scatter_avg <- stat <- as_tagged_function({{ stat }}) - ppc_scatter_avg( + p <- ppc_scatter_avg( y = if (is_null(x)) y else x, yrep = errors, size = size, alpha = alpha, ref_line = FALSE, stat = stat - ) + - labs( - x = error_avg_label(stat), - y = if (is_null(x)) y_label() else as_label((qx)) - ) + if (is_null(x)) { - NULL - } else { - coord_flip() - } + ) + + if (is_null(x)) { + p + labs(x = error_avg_label(stat), y = y_label()) + } else { + p + + aes(x = .data$y_obs, y = .data$value) + + labs(x = as_label((qx)), y = error_avg_label(stat)) + } } @@ -323,11 +323,11 @@ ppc_error_scatter_avg_vs_x <- function( ref_line = FALSE, stat = stat ) + + aes(x = .data$y_obs, y = .data$value) + labs( - x = error_avg_label(stat), - y = as_label((qx)) - ) + - coord_flip() + x = as_label((qx)), + y = error_avg_label(stat) + ) }