Hiding facet row or column headers

Viewed 259

How can I hide the row (or column) header labels in a facet chart?

I rotated the labels by 45 degrees in the following example (copied from this post) to highlight which ones I mean, the year numbers:

import altair as alt
from vega_datasets import data

df = data.seattle_weather()

alt.Chart(df).mark_rect().encode(
    alt.Y('month(date):O', title='day'),
    alt.X('date(date):O', title='month'),
    color='temp_max:Q'
).facet(
    row=alt.Row(
        'year(date):N',
        header=alt.Header(labelAngle=45)
    )
)

plot

2 Answers

Another way to do this is to turn off the labels by setting labels=False:

header=alt.Header(labels=False)

One way to do this is to use a labelExpr containing an empty string:

header = alt.Header(labelExpr="''")
Related