This example code show 6 facets, ordered by their means. How could I display only e.g. 2 top or bottom facets, which are ordered this way? I tried playing around with the transform_window rank option with no luck, it limits the bar contents of all the facets instead.
import altair as alt
from vega_datasets import data
source = data.barley()
alt.Chart(source).mark_bar().encode(
x='yield:Q',
y='year:O',
color='year:N',
facet=alt.Facet('site',
sort={
'field': 'yield',
'op': 'mean',
'order': 'descending'
},
columns=1
)
)
