Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve syntax for argmin/max #1642

Open
kanitw opened this issue Aug 6, 2019 · 2 comments · May be fixed by #3505
Open

Improve syntax for argmin/max #1642

kanitw opened this issue Aug 6, 2019 · 2 comments · May be fixed by #3505
Labels
enhancement vega: vega-lite Requires upstream action in `vega-lite`

Comments

@kanitw
Copy link
Member

kanitw commented Aug 6, 2019

Right now we need something like

alt.Y(aggregate=alt.ArgmaxDef(argmax=<f>), field=..., type=...)

to make the following in Vega-Lite:

{aggregate: {argmax: <f>}, field: ..., type: ...}

It would be more natural to allow:

alt.Y(aggregate=alt.Argmax(<f>), field=..., type=...)

Same for argmin. :)

@jakevdp
Copy link
Collaborator

jakevdp commented Aug 6, 2019

That syntax should work currently without the keyword

>>> import altair as alt
>>> alt.X('x:Q', aggregate=alt.ArgminDef('y')).to_dict()
{'aggregate': {'argmin': 'y'}, 'field': 'x', 'type': 'quantitative'}

@kanitw
Copy link
Member Author

kanitw commented Aug 6, 2019

Ah i see. The only question is whether we should cut ‘Def’ suffix to make it more reader friendly. If you agree, i can fix it from Vega-Lite schema as well.

@jakevdp jakevdp added enhancement vega: vega-lite Requires upstream action in `vega-lite` labels Nov 23, 2019
@dangotbanned dangotbanned linked a pull request Dec 23, 2024 that will close this issue
@dangotbanned dangotbanned linked a pull request Dec 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement vega: vega-lite Requires upstream action in `vega-lite`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants