scverse / scverse/spatialdata-plot
Custom title when multiple coordinate system present and no coordinate system specified
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 86
- 派生
- 21
- 平均合并
- 14 小时 50 分钟
- 30 天内合并 PR
- 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
after setting the title
not sure why the order changes but no big deal, not the point of this issue
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_systemswill have a new default ofNone.- if the object has a single coordinate system and
coordinate_systemisNone, this will be plotted - elif the object has multiple coordinate system and
coordinate_systemisNoneand one of them is called'global'(defined infrom spatialdata.models._utils import DEFAULT_COORDINATE_SYSTEM), this will be plotted - if
coordinate_systemis notNoneandcoordinate_systemis available, this will be plotted - else (i.e. if
coordinate_systemisNone, multiple coordinate systems are present and none of them is called'global', or ifcoordinate_systemis notNoneand 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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从入口点 pl.show() 开始,跟踪对象具有一个或多个坐标系时如何选择 coordinate_systems 的默认值。完成的标准是:默认值选择唯一的系统或全局系统;不存在有效默认值时,抛出包含可用系统的错误;并且仍允许调用方显式传入列表。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100