1 回答

TA貢獻1875條經(jīng)驗 獲得超3個贊
您的秤是獨立的,但您的分檔不是。遺憾的是,Vega-Lite 語法沒有提供簡單的方法來定義將不同的 bin 參數(shù)應用于不同的數(shù)據(jù)子集的 bin 轉(zhuǎn)換,因此您必須手動對圖表的每個面板使用不同的 bin 轉(zhuǎn)換。
我可能會做這樣的事情:
chart = alt.Chart(data).mark_bar().encode(
x = alt.X('delay:Q',
axis=alt.Axis(title=''),
scale=alt.Scale(zero=False),
bin=alt.Bin(maxbins=20)),
y = alt.Y('count():Q',
axis=alt.Axis(title='')),
color = alt.Color('origin:N')
).properties(
width=130,
height=130
)
alt.ConcatChart(
concat=[
chart.transform_filter(alt.datum.origin == value).properties(title=value)
for value in sorted(data.origin.unique())
],
columns=4
).configure_title(
fontSize=20,
font='Courier',
anchor='middle',
color='gray',
align='left'
).resolve_axis(
x='independent',
y='independent'
).resolve_scale(
x='independent',
y='independent'
)
添加回答
舉報