scverse / scverse/spatialdata-plot

Vega-like viewconfigurations

未关闭
#388 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
86
派生
21
平均合并
14 小时 50 分钟
30 天内合并 PR
3

描述

During the hackathon in Basel we have brainstormed on the specification that would allow for viewing data across the spatialdata visualization ecosystem with one viewconfig. This issue describes the current ideas of this viewconfiguration.

Data

The first field in the view configuration is related to the data and specifies the zarr store and the particular elements that we want to visualize. It also includes a filtering step. For example:

"schema": "https://spatialdata-plot.github.io/schema/viewconfig/v1.json"
"height": 15 # This is in inches
"width": 14
"data": [
        {
            "name": "{UUID1}",
            "url": "blobs.zarr"
            "format": "spatialdata",
            "version": "0.2.0"
        },
        {
          "name": "{UUID2}",
          "format": "spatialdata_image",
          "version": "0.1.0",
          "source": "UUID1",
          "transform": [
            {
              "type": "filter",
              "expr": "datum['images/blobs_image']"
            }
          ]
        },
  ]      

Here the first block contains the location of the zarr store. We specify the particular format of the zarr store and the version. The name is serving as a UUID in the document so that other blocks in the configuration can refer to a particular block. Typically, on the data a transform is applied. In most cases for SpatialData this would be a filter transform initially to get the particular element that we require. The height and width is the overall size in inches of the plot.

Scales

Scales provide a mapping of a series of values to a different series of values, whether that is axes limits and ticks
or a mapping of values to color.

"scales": [
        { <!-- Example of scale for continuous variable-->
          "name": "color_0", <!-- can chain render_... calls that would use different normalize objects-->
          "type": "linear",
          "zero": true, <!-- Whether to include 0 value in the color mapping, useful for labels-->
          "domain": [0, 1],  <!-- this is the vmin vmax-->
          "clamp": true,  <!-- This is the clip of the normalize object in matplotlib-->
          "range": {"scheme": "gray"}
        },
        { <!-- Example of scale for categorical variable-->
      "name": "color",
      "type": "ordinal",
      "domain": {"data": "UUID of spatial element", "field": "category"}, <!-- category here is column-->
      "range": {"scheme": "category20"} <!--This is only required if there are no hex strings specified before, in some cases a user can already have the hexstrings representing color. In this case the color encoding in marks must be used.-->
        },
        {
              "name": "X_SCALE",
              "type": "linear",
              "zero": true,
              "domain": [-180, 180], <!-- This is the extent of the axes after having applied the transform to coordinate system-->
              "range": "width" <!-- refers to plot width-->
            },
            {
              "name": "Y_SCALE",
              "type": "linear",
              "zero": true,
              "domain": [-81, 87],
              "range": "height" <!-- refers to plot height-->
            }
    ],

Marks

Marks define the actual plots of the particular elements.

"marks": [
        {
          "type": "raster", <!-- type of element -->
          "from": {"data": "UUID3"},
          "zindex": 0,
          "encode": {
              <!-- "channel": {"value": 0}, // with "data": "UUID2" -->
              "opacity": {"value": 1}, <!-- sdata-plot "alpha". Also, it was fillOpacity -->
              "color": {"scale": "normalize", "field": "channel_zero_name"}
              <!--"zindex": {"field": "point_importance"}-->
          }
        },
        {
          "type": "shape", <!-- type of element -->
          "from": {"data": "UUID5"},
          "zindex": 1,
          "encode": {
              <!-- "channel": {"value": 0},
              "opacity": {"value": 1}, <!-- sdata-plot "alpha". Also, it was fillOpacity -->
              "color": {hexstrings} <!-- in case of predetermined hexstrings --> 
              <!--"zindex": {"field": "point_importance"}-->
          }
        }
      ],

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先审查针对数据、尺度和标记所提出的视图配置部分,包括其中的 SpatialData 引用和变换。整个 spatialdata 可视化生态系统对视图配置规范达成解决方案并取得一致意见后,即视为完成;该 issue 未指定实现文件或测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
data-visualization
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
20/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。