-
Notifications
You must be signed in to change notification settings - Fork 749
Labels
bugSomething isn't workingSomething isn't workinghelp wantedYour expertise is better than ours, we would love your helpYour expertise is better than ours, we would love your help
Description
Describe the bug
When creating a composite Altair chart, the legend selection won't work.
Will you submit a PR?
- Yes
Environment
{
"marimo": "0.16.5",
"editable": false,
"location": "/Users/zeintawil/.pyenv/versions/3.10.13/envs/vdl-env/lib/python3.10/site-packages/marimo",
"OS": "Darwin",
"OS Version": "24.5.0",
"Processor": "arm",
"Python Version": "3.10.13",
"Locale": "en_US",
"Binaries": {
"Browser": "140.0.7339.215",
"Node": "v22.3.0"
},
"Dependencies": {
"click": "8.1.8",
"docutils": "0.22",
"itsdangerous": "2.2.0",
"jedi": "0.19.2",
"markdown": "3.7",
"narwhals": "2.6.0",
"packaging": "24.2",
"psutil": "7.0.0",
"pygments": "2.19.1",
"pymdown-extensions": "10.16.1",
"pyyaml": "6.0.2",
"starlette": "0.46.1",
"tomlkit": "0.13.2",
"typing-extensions": "4.12.2",
"uvicorn": "0.34.0",
"websockets": "15.0.1"
},
"Optional Dependencies": {
"altair": "5.5.0",
"duckdb": "1.2.2",
"openai": "1.68.2",
"pandas": "1.5.3",
"pyarrow": "19.0.1",
"ruff": "0.11.5"
},
"Experimental Flags": {}
}
Code to reproduce
sample_data = [
[2, 1, 4, 10, 'a',],
[3, 0, 6, 12, 'b',],
[8, 5, 12, 15, 'c'],
]
sample_df = pd.DataFrame(sample_data, columns=['value', 'lower', 'upper', 'x_value', 'category'])
sample_color = alt.Color(
field="category",
type="nominal",
legend=alt.Legend(
title='category',
labelLimit=0,
symbolLimit=0,
),
)
sample_base_chart = alt.Chart(sample_df, title="Sample Error Bars")
sample_rule = sample_base_chart.mark_rule().encode(
x=alt.X('x_value'),
y=alt.Y('upper'),
y2='lower',
color=sample_color,
)
sample_upper_tick = sample_base_chart.mark_tick(orient='horizontal', size=5).encode(
x='x_value:Q',
y='upper:Q',
color=sample_color,
)
sample_tick = sample_upper_tick.encode(y='lower:Q')
sample_lines = sample_rule + sample_upper_tick + sample_tick
sample_dots = sample_base_chart.mark_point(
filled=True, size=60
).encode(
x=alt.X('x_value'),
y=alt.Y('value'),
color=sample_color,
)
alt_chart = sample_dots + sample_lines
sample_mo_chart = mo.ui.altair_chart(alt_chart)
sample_mo_chartMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedYour expertise is better than ours, we would love your helpYour expertise is better than ours, we would love your help