Skip to content

Mark Image doesn't get positioned correctly on y axis without a height attribute #8687

@john-guerra

Description

@john-guerra

When creating an image scatterplot with vega-lite Images were positioned incorrectly. See this layered chart where the points don't match the position of the images

After some exploration, the only way I could get the images to position correctly was by adding the height attribute to the mark

Minimal example to reproduce the bug

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "layer": [
    {
      "mark": {"type": "image" },
      "encoding": {
        "x": {"field": "title", "type": "nominal"},
        "url": {"field": "img", "type": "nominal"},        
        "y": {"field": "score", "type": "quantitative"},
        "tooltip": {"field": "title"}
      }
    },
    {
      "mark": {"type": "point"},
      "encoding": {
        "x": {"field": "title", "type": "nominal"},
        "y": {"field": "score", "type": "quantitative"},
        "tooltip": {"field": "title"}
      }
    }
  ],
  "data": {
    "values": [
      {
        "title": "Minecraft",
        "score": 4.5664163,
        "img": "https://play-lh.googleusercontent.com/yAtZnNL-9Eb5VYSsCaOC7KAsOVIJcY8mpKa0MoF-0HCL6b0OrFcBizURHywpuip-D6Y=w832-h470"
      }
    ]
  },
  "width": 200
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions