You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I opened this as a feature request, but maybe it is more of a discussion as a follow up to #2991. The overall sentiment is whether Altair should simplify redundancy in layered specs by moving common encodings to the top level of the Chart instead of repeating them in each layer. I think this is low priority as it would not change any functionality when working in Altair, just the verbosity of the VL spec.
Currently, if we create an Altair spec like this, the code suggests that the encodings are part of the top level chart (base) and shared between the marks:
A more suitable translation would be to include a top-level encoding that can be shared by all the layered marks. This leads to a less verbose Vega-Lite spec that is more semantically similar to how the code is written in Altair:
I wonder if Altair should try to figure out which encodings are shared between layers and can be moved to the top-level? There is not that much practical benefit from this as the encodings in Altair's grammar can still be thought of conceptually as belonging to the chart and shared by each mark that is added to the chart (even when the code is written as in the first example, it is just that this is not how it works under the hood). I am not sure if there are situations where this automatic move would be undesired.
The text was updated successfully, but these errors were encountered:
I opened this as a feature request, but maybe it is more of a discussion as a follow up to #2991. The overall sentiment is whether Altair should simplify redundancy in layered specs by moving common encodings to the top level of the Chart instead of repeating them in each layer. I think this is low priority as it would not change any functionality when working in Altair, just the verbosity of the VL spec.
Currently, if we create an Altair spec like this, the code suggests that the encodings are part of the top level chart (
base
) and shared between the marks:However, what actually happens is that the encodings are redundantly copied into the mark of each layer in the Vega-Lite spec:
A more suitable translation would be to include a top-level encoding that can be shared by all the layered marks. This leads to a less verbose Vega-Lite spec that is more semantically similar to how the code is written in Altair:
That VL spec can actually be generated in Altair if we use
LayerChart
directly:I wonder if Altair should try to figure out which encodings are shared between layers and can be moved to the top-level? There is not that much practical benefit from this as the encodings in Altair's grammar can still be thought of conceptually as belonging to the chart and shared by each mark that is added to the chart (even when the code is written as in the first example, it is just that this is not how it works under the hood). I am not sure if there are situations where this automatic move would be undesired.
The text was updated successfully, but these errors were encountered: