Skip to content

Point-selection of Altair rect chart results are wrong #7661

@Vrantheo

Description

@Vrantheo

Describe the bug

I want to make an Altair heatmap then use the alt.selection_point() method to do interactive selection of individual points, however the selected results incorrectly included non-selected points, which are "diagonal" to the selected ones.

Steps to reproduce:
Make an Altair chart with mark_rect()
Configure chart with alt.selection_point()
Shift-click to select two points, with both x and y different
Use chart.value to inspect selection results

Expected outcome:
chart.value should have two rows, one for each selected point

Actual outcome:
chart.value has four rows, two correct ones, two incorrect ones with inverted x and y

Selecting three or more points results in more convoluted outcomes. All the points together seem to form cartesian products.

I used Marimo AI to generate mock examples and can also reproduce this bug, provided below. So I'm sure it's not problem of just my own code.

Will you submit a PR?

  • Yes

Environment

Details
(Not needed, check below)

Code to reproduce

(Marimo AI generated example. Pandas-related cell warnings are irrelevant. My own code used Polars only and the bug stays the same.)

Marimo App permalink:
https://marimo.app/?slug=03ny54

Or WASM link:
https://marimo.app/#code/JYWwDg9gTgLgBCAhlUEBQaD6mDmBTAOzykRjwBNMB3YGACzgF44AiAVwIGsCIqCW0iMGCYJkqAHQBBYQAoAlBjQABIWAkBjPABttacngBmcTAoBcaOFbihIsMShAQ4iAM4J01m+GjwwiAnI3F3cwcktrW184AjZwAE8QmLAIqyj7RG0YRGAoJMyYVLgoPBg2KAIXLIAaD1qCMFqwpVVhTR09A2NTBqbyeQsvAGI4AGES0jwPDU44IOy4Q2g4eim6PFIkFK8GiRJAiBAJVzwKWQAWACZFLyhed2YARgAGIo0IbQe4AA4igA9MNpEAAjHRfADahhYAA0AN7AAC+LEWy2ANkq+3wsketXenwA1I95ABdIrxQEgsGiSEsACasIAVkiUXkGejigEsTjivdCSSMF55ohqaSvEs8olgJVyUDQZ9Bl5rOK4H92QDZWCFYrFQA3TJsKbMXb7ciHPYBchSmCyZ61F7PG7axVCiRqQjkWSwmEsMwq2p0n1weL+gBq+rwgb12gNCMURXWmyEmHIxmYYQkABFSIgAGIkEB4WRCx1WBMwLbJwxFEplCpwWRlisp6pxlRqdq6fRGEyyAq1RtJ5seAZFEbjDZkFyVK3ERAaGDAHVTKRZHJ5AciGj0BBsLLAAC0kCtcBO2jw8+AEAIRVP54XV9EBWOOjvl4ImCPBGthmAOnIrkYcFvX9WkWGJWpgSlchGBYM98ECFhahgCAcBwM9GAAFSgA1cTPZAYI0bRgBmFg4y8DdMA0OhkHgZhZCKLwn1GajYAbCcm0MEtFQkJAoE4TASnnBQGOsCRCHeAx6KdRU-kYJ9oVkGEzAAeUQlZaHQmE4AAGUpbRSOqETtXiOSsgkWlFNpFS1IXGBNNpHS9IMozFTxaBTJgCRRg+aBFLDaM8DMABFNTXA0TI8A8iQAGVwrPWQwvWAsYJ1XJgEtVxSPkQzpK8ZCPgXMBAOA1hQNDcMwJcrivFdchKH8fNXASl8LyvarRPEiBJJcrwIH8DRaBMp93kCWg32as9WoIWonyjA1sWyqpPLmwtngkABmeR2qsLiyOsCi2DRZgnAkQ7XVXXJKJY60KKomiuIO4Bq1KcpKjYxMwEwQ6WxadstE7Loe0ekdhjgDNgFcMAgUSVYTxashyDgT8YHcQw7hAFZ1jgDd43YpMzpW57a2vDBgG6TACEQAtsCYZgWGwJApWwH0inbbCCGEoA

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions