Reputation: 53
How can I edit the font size of the years appearing above each subgraph in the example below: Take from the altair gallery
import altair as alt
from vega_datasets import data
source = data.population.url
alt.Chart(source).mark_area().encode(
x='age:O',
y=alt.Y(
'sum(people):Q',
title='Population',
axis=alt.Axis(format='~s')
),
facet=alt.Facet('year:O', columns=5),
).properties(
title='US Age Distribution By Year',
width=90,
height=80
)
Upvotes: 1
Views: 2961
Reputation: 86330
You can set this using labelFontSize
in the header
property of the facet
encoding:
import altair as alt
from vega_datasets import data
source = data.population.url
alt.Chart(source).mark_area().encode(
x='age:O',
y=alt.Y(
'sum(people):Q',
title='Population',
axis=alt.Axis(format='~s')
),
facet=alt.Facet(
'year:O', columns=5,
header=alt.Header(labelFontSize=20)
),
).properties(
title='US Age Distribution By Year',
width=90,
height=80
)
For the full list and description of available header properties, see https://altair-viz.github.io/user_guide/generated/core/altair.Header.html
Upvotes: 3