Skip to content

Nested concatenated altair charts with vconcat(hconcat(...), ...) cannot be shown using mo.ui.altair_chart #6323

@andycasey

Description

@andycasey

Describe the bug

I seem to be experiencing a bug with nested charts.

If I use the code to reproduce that I have given below, here is what the plot looks like to me:

Image

If I re-arrange the nesting like in #5015, then it works fine. But when I rearrange to have an outer vconcat and an inner hconcat, all plots disappear.

Will you submit a PR?

  • Yes

Environment

{
  "marimo": "0.15.3",
  "editable": false,
  "OS": "Darwin",
  "OS Version": "23.5.0",
  "Processor": "i386",
  "Python Version": "3.12.5",
  "Binaries": {
    "Browser": "140.0.7339.133",
    "Node": "v22.18.0"
  },
  "Dependencies": {
    "click": "8.2.1",
    "docutils": "0.21.2",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.9",
    "narwhals": "2.4.0",
    "packaging": "25.0",
    "psutil": "7.0.0",
    "pygments": "2.19.2",
    "pymdown-extensions": "10.16.1",
    "pyyaml": "6.0.2",
    "starlette": "0.47.3",
    "tomlkit": "0.13.3",
    "typing-extensions": "4.14.1",
    "uvicorn": "0.35.0",
    "websockets": "15.0.1"
  },
  "Optional Dependencies": {
    "altair": "5.5.0",
    "pandas": "2.3.1",
    "pyarrow": "21.0.0",
    "loro": "1.6.0"
  },
  "Experimental Flags": {}
}

Code to reproduce

from vega_datasets import data
import marimo as mo
import altair as alt

cars = data.cars()

_chart = (
    alt.Chart(cars)
    .mark_point()
    .encode(
        x="Horsepower",
        y="Miles_per_Gallon",
        color="Origin",
    )
    .properties(height=100)
)

stacked_chart = alt.vconcat(
    alt.hconcat(
        _chart,
        _chart,
    ),
    _chart
)


mo.ui.altair_chart(stacked_chart)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedYour expertise is better than ours, we would love your help

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions