Skip to content

Can't plot different elements in a specific axes when multiple coordinate systems are available #176

Open
@LucaMarconato

Description

@LucaMarconato

Intro

The bug that I'll describe is a consequence of the current coordinate systems implementation and will disappear when it will be refactored. The bug needs to be fixed upstream, but has a consequence in spaitaldata-plot. Nothing to do now, I report it so that we can check that things work when the transformation refactoring is implemented.

To reproduce one can run the last cell of the densenet example notebook.

Description

The function sdata.filter_by_coordinate_system() returns elements that are present in a coordinate system but it doesn't remove eventual transformations to other coordinate systems. This can't be done with the current design.

A consequence in spatialdata plot is a bug in the following scenario (this is what happens in the densenet notebook):

  1. I want to make a plot with 4 subplots, I'll do passing pl.show(ax=axes[i])
  2. Each subplot will have an image element and a shapes element
  3. I want to plot only the aligned coordinate system. The image is mapped to aligned, the shapes is mapped to aligned and global.

Now, since the global is not removed by sdata.filter_by_coordinate_system() (it can't, otherwise it compromises the original object), this leads to spatialdata-plot try to span extra axes, to fit the elements in global, leading to an error.

Solution

Since I will remove the actual transformations from the spatial elements, by placing them instead in sdata, the new sdata object returned by sdata.filter_by_coordinate_system() can just drop the alignment to global without the need to modify the original objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: lowstaleNo activity for a long period of time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions