From 84f2d4e304f87b0ae68b9ea4bea5f54f8915d82f Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Wed, 6 May 2026 17:47:17 +0200 Subject: [PATCH 1/2] Flip coordinates in plotImage() --- R/plotImage.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/plotImage.R b/R/plotImage.R index af48765..4980bec 100644 --- a/R/plotImage.R +++ b/R/plotImage.R @@ -221,4 +221,4 @@ setMethod("plotImage", "SpatialData", \(x, i=1, j=1, k=NULL, ch=NULL, c=NULL, cl #' @export #' @rdname plotImage #' @importFrom ggplot2 ggplot scale_y_reverse coord_fixed -plotSpatialData <- \() ggplot() + coord_fixed() + .theme +plotSpatialData <- \() ggplot() + scale_y_reverse() + coord_fixed() + .theme From 2eb74db66ec8c67a99cf2264c19a8812b3611687 Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Wed, 6 May 2026 18:26:19 +0200 Subject: [PATCH 2/2] Add comment to motivate scale_y_reverse() approach --- R/plotImage.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/plotImage.R b/R/plotImage.R index 4980bec..af979e4 100644 --- a/R/plotImage.R +++ b/R/plotImage.R @@ -222,3 +222,7 @@ setMethod("plotImage", "SpatialData", \(x, i=1, j=1, k=NULL, ch=NULL, c=NULL, cl #' @rdname plotImage #' @importFrom ggplot2 ggplot scale_y_reverse coord_fixed plotSpatialData <- \() ggplot() + scale_y_reverse() + coord_fixed() + .theme +# `annotation_raster` plots the array the same way it is printed, i.e., with the +# row 1 at the top, which means we need to flip the y-axis to have the correct axis labels. +# We tried flipping the image itself but it means everything gets out of alignement if +# the user sets `scale_y_reverse()` themselves. \ No newline at end of file