Skip to content

Bug: plotting after sorting a table #178

Closed

Description

@LucaMarconato

We just caught a bug in napari-spatialdata (described in this comment scverse/napari-spatialdata#175 (comment), but no need to read there, I will summarize here) and I just noticed that this a bug also of spatialdata-plot.

Currently, napari_spatialdata, when plotting labels, seems to match the table to the labels using the order of the rows instead than using the instance_key (this is handled correctly for circles btw). I verified this for spatialdata-plot and I noticed that the order of the table influences the plot. I am surprised that this happens because I would have bet that the tests added here https://github.com/scverse/spatialdata-plot/pull/163/files would have covered also this case, but apparently this is not the case.

The code to reproduce this (which makes the plots both with napari and spatialdata-plot and then one needs to check by eye) is the one posted in this comment here: scverse/napari-spatialdata#175 (comment).

Please notice that spatialdata-plot can't make the first two plots because of this bug with plotting continuous annotations to labels: #165.

Also please notice that I had to add

import matplotlib.pyplot as plt
plt.show()

in the end because for some reasons pl.show() was not working. This is something tracked elsewhere, I will report it separately by reopening that issue.

Activity

  1. changed the title [-]Check: plotting after sorting a table[/-] [+]Bug: plotting after sorting a table[/+] on Nov 5, 2023
  2. LucaMarconato commented on Nov 5, 2023

    @LucaMarconato
    MemberAuthor

    Anyway, the bug has a simple solution. Calling the function match_table_to_element() #178 returns a table with rows that match the element, even in the case of partial overlap between the instances in the element and the rows of the table.

    A better solution is to drop region, region_key, instance_key (but this will take some time). CC @giovp @kevinyamauchi.

  3. LucaMarconato commented on Nov 5, 2023

    @LucaMarconato
    MemberAuthor

    sdata3:
    image

    sdata4:
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions