From bef6c5f83d24475a83d7ad97ccc00a16e47140df Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Wed, 6 May 2026 16:52:17 +0200 Subject: [PATCH 1/2] Flip image to match other layers --- R/plotImage.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/R/plotImage.R b/R/plotImage.R index af48765..5e56a86 100644 --- a/R/plotImage.R +++ b/R/plotImage.R @@ -163,6 +163,12 @@ NULL a <- .get_multiscale_data(x, k) a <- a[.ch_idx(x, ch),,,drop=FALSE] a <- .norm_ia(a, data_type(x)) + # We later use `annotation_raster()`, which plots the array the same way it is printed, + # i.e., with the row 1 at the top, which doesn't match the rest of the ecosystem, + # so we mirror the image horizontally. + # FIXME: at some point, we would like to use `SpatialData::mirror()` directly in the + # `plotImage()` for this but it's currently not lazy and super slow. + a <- a[, rev(seq_len(dim(a)[2])), , drop=FALSE] a <- .prep_ia(a, c, cl) } From 75157af23bf5f06fec678a07a41fda161e870a3b Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Wed, 6 May 2026 17:39:44 +0200 Subject: [PATCH 2/2] Make sure shape use same coords as image --- R/plotFrame.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/plotFrame.R b/R/plotFrame.R index 8bc4948..9e5ea86 100644 --- a/R/plotFrame.R +++ b/R/plotFrame.R @@ -82,7 +82,7 @@ NULL list( do.call(geom_sf, c(list(data=df, mapping=aes), c(dot))), theme(legend.key.size=unit(0.5, "lines")), - coord_sf(expand=FALSE, reverse="y")) + coord_sf(expand=FALSE)) } #' @export #' @rdname plotFrame