Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x and y axes labels swapped in ImageDimPlot #6132

Closed
orrzor opened this issue Jun 30, 2022 · 2 comments
Closed

x and y axes labels swapped in ImageDimPlot #6132

orrzor opened this issue Jun 30, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@orrzor
Copy link

orrzor commented Jun 30, 2022

Hi Seurat team! I noticed when doing the imaging-data spatial vignette that the x and y axes labels are swapped when running ImageDimPlot(vizgen.obj, fov = "s2r1", axes = T) and ImageDimPlot(vizgen.obj, fov = "hippo", axes = T). It's pretty clear when you plot the cropped FOV that the cropping is correct but the labels of the x and y axes are swapped. Thanks for building all these helpful tools. Best, Orr

ImageDimPlot(vizgen.obj, fov = "s2r1", axes = T)
ImageDimPlot(vizgen.obj, fov = "hippo", axes = T)
@orrzor orrzor added the bug Something isn't working label Jun 30, 2022
@pander21
Copy link

Hi, I raised this issue previously here: https://github.com/satijalab/seurat/issues/6110 and the answer was that this was done intentionally. However, I still think this behaviour is undesired and solution offered there is not sufficient for following reasons:

If one uses coord_flip from ggplot2 package as suggested:
ImageDimPlot(data, fov = fov1, coord.fixed = TRUE) & coord_flip()
This overrides argument coord_fixed in ImageDimPlot which results in distorted aspect ratio!

This can be overcomed again by specifying exact aspect ratio by adding theme(aspect.ratio = your.precalculated.ratio) as such:
my.ratio = range.y.axis / range.x.axis ImageDimPlot(data, fov = fov1, coord.fixed = TRUE) & coord_flip() & theme(aspect.ratio = my.ratio)
And while this is bit cumbersome, it works, but ONLY with one field of view at a time.

However, if one wants to plot multiple fields of view, e.g. in replicated experiments by adding vector of fovs to fov argument of ImageDimPlot, even this solution fails, as each field of view will have different aspect ratio.
ImageDimPlot(data, fov = c(fov1, fov2), coord.fixed = TRUE) & coord_flip() & theme(aspect.ratio = my.ratio) - only first image is with correct orientation and correct axes ratio.

Perhaps Seurat team could look into this again and fix the ImageDimPlot() to have the desired behavior of plotting axes correctly in the first place, or providing another solution to plotting both axes and aspect ratios correctly, even with multiple fields of view. Thanks!

@longmanz
Copy link
Contributor

longmanz commented Jul 7, 2023

Hi,
Thank you for noticing this issue. Although this is not a bug (as mentioned in #6110 (comment)), this auto-flip will indeed distort the x and y ratio. We will likely be adding an enhancement to the ImageDimPlot() and ImageFeaturePlot() in our next release.
I will close this issue for now, and will update you once the enhancement is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants