scverse / scverse/spatialdata-plot

Custom title when multiple coordinate system present and no coordinate system specified

オープン
#269 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

:speaking_head: discussion enhancement priority: medium
主要言語
Python
スター
86
フォーク
21
平均マージ
14時間 50分
マージ済み PR(30日)
3

説明

When there is a object with 2 coordinate systems and pl.show() is called without specifying coordinate_systems, by default two subplots are created. If the user adjust the title=, both titles are changed, leading to a plot that is confusing, especially if it was not clear that the object (or an element of the object) was aligned to multiple coordinate systems.

This is exactly what happened in the following plots (that appeared from a bug reported by a user).

before setting the title

Screenshot 2024-05-30 at 11 55 06

after setting the title

not sure why the order changes but no big deal, not the point of this issue
Screenshot 2024-05-30 at 11 55 11

solution for this case

Solution for the user: here the fix is to specify coordinate_systems='global', which will lead to a single plot.

proposed solution

Discussed also with @melorona. I proposed to change the default behavior as follows:

  • coordinate_systems will have a new default of None.
  • if the object has a single coordinate system and coordinate_system is None, this will be plotted
  • elif the object has multiple coordinate system and coordinate_system is None and one of them is called 'global' (defined in from spatialdata.models._utils import DEFAULT_COORDINATE_SYSTEM), this will be plotted
  • if coordinate_system is not None and coordinate_system is available, this will be plotted
  • else (i.e. if coordinate_system is None, multiple coordinate systems are present and none of them is called 'global', or if coordinate_system is not None and it's not available in the data, then an error will be raised, printing the list of available coordinate systems.

What will change for the user:

  • with this change, by default we won't plot multiple coordinate systems; if this is still the desired behavior, the user can still pass a list of coordinate systems.

Extra comments:

  • with the incoming "transformations refactoring" it will be required to specify which coordinate system to plot because elements will not contain an explicit list of coordinate systems they are aligned to but there will only be a big graph of transformations where a lot of coordinate systems can be aligned to a lot of other coordinate systems. So it will be important to plot only what the user asks for
  • in general, the current default behavior is useful when there are multiple FOVs for a dataset (like in the MIBITOF example dataset); but in other cases where there is the same data in multiple coordinate systems, like in Xenium, or where the number of FOVs is very large, like in CosMx, the currently implemented default behavior is suboptimal, and requiring the proposed new default would be handier.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

エントリーポイント pl.show() から始め、オブジェクトが1つまたは複数の座標系を持つ場合に coordinate_systems のデフォルトがどのように選択されるかを追跡します。デフォルトが唯一のシステムまたはグローバルシステムを選択し、有効なデフォルトが存在しない場合は利用可能なシステムを含むエラーを発生させ、呼び出し側が引き続きリストを明示的に渡せることを完了条件とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
data-visualization
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。