vega / altair

Declarative statistical visualization library for Python
https://altair-viz.github.io/
BSD 3-Clause "New" or "Revised" License
9.34k stars 794 forks source link

Describe the differences between `alt.value` and `alt.ColorValue`, `alt.ShapeValue`, etc #2752

Open joelostblom opened 1 year ago

joelostblom commented 1 year ago

I am not sure my self about what the exact differences are here. Vega-Lite only has value as far as I know, so maybe ColorValue etc are just help classes in altair to show better docstrings? I must say that I don't find the docstrings overly useful though.

The only example I know where there is a difference and we are required to use ShapeValue instead of value (to avoid a NotImplementedError) is https://altair-viz.github.io/gallery/isotype_grid.html. @palewire I saw that you initially added that example, so maybe you know the answer to this question?

mattijn commented 1 year ago

I think it its the other way around, alt.value is a helper function for not needing to define alt.<encoding-channel>Value. It is defined here as top-level function: https://github.com/altair-viz/altair/blob/master/altair/vegalite/v5/api.py#L285.

Using altair main repo the usage of value also works fine for me in this example.