我想为我的多面 (2x2) Altair 图表指定一个主标题。目前每个子图上面都有标题,很乱。
这是我正在使用的代码:
alt.data_transformers.disable_max_rows()
selection = alt.selection_multi(fields=['component_name'], bind='legend')
alt.Chart(top_n)\
.mark_line(
strokeWidth = 1.2
).encode(
x = alt.X('click_date_local', title = 'Click Date', axis=alt.Axis(domain=False, format='%b%y', tickSize=0)),
y = alt.Y('Num_Component_Visits', title = 'Component Clicks/Day'),
color = alt.Color('component_name', scale=alt.Scale(scheme='tableau20'), legend=alt.Legend(title="Component Name")),
opacity = alt.condition(selection, alt.value(1), alt.value(0.2)),
tooltip = ['component_name']
).properties(
width=300,
height=200,
title = 'Clicks per Day for Top 15 Components by Covid Period'
).facet(
column = alt.Column('covid_period', sort = ['Pre', 'Post'], title = 'Covid Period'),
row = alt.Row('efficient_flag', title = 'Efficient Flag')
).resolve_scale(
x='independent',
y = 'independent'
).configure_axis(
grid=False
).add_selection(
selection
)
慕尼黑5688855
相关分类