Skip to content

Flip image to match other layers#21

Closed
Bisaloo wants to merge 2 commits into
mainfrom
flip-img
Closed

Flip image to match other layers#21
Bisaloo wants to merge 2 commits into
mainfrom
flip-img

Conversation

@Bisaloo
Copy link
Copy Markdown
Collaborator

@Bisaloo Bisaloo commented May 6, 2026

Alternative to #23

library(SpatialData.plot)
#> Loading required package: SpatialData
#> 
#> Attaching package: 'SpatialData'
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:utils':
#> 
#>     data
#> The following objects are masked from 'package:base':
#> 
#>     labels, scale, sequence, table, transform

sd <- SpatialData.data::LungAdenocarcinomaMCMICRO()
sp <- crop(sd, list(
  xmin=0, xmax=2500,
  ymin=600, ymax=3200))
# original
plotSpatialData() + plotImage(sd,
  ch=c("CD16", "CD45", "FOXP3", "DNA_7", "ECAD", "SMA"),
  c=c("cyan", "magenta", "yellow", "blue", "green", "red"))

# cropped
plotSpatialData() + plotImage(sp,
  ch=c("CD16", "CD45", "FOXP3", "DNA_7", "ECAD", "SMA"),
  c=c("cyan", "magenta", "yellow", "blue", "green", "red"))

Created on 2026-05-06 with reprex v2.1.1

@Bisaloo
Copy link
Copy Markdown
Collaborator Author

Bisaloo commented May 6, 2026

After discussion, we decided to go with #23 because the approach here will cause everything to go out of alignment if the user sets scale_y_reverse() themselves.

@Bisaloo Bisaloo closed this May 6, 2026
@Bisaloo Bisaloo deleted the flip-img branch May 6, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant