How to specify different colors for column labels in altair

29 views Asked by At

Is there a way to specify different colors for column labels with python altair? Take the grouped bar chart example where bars are grouped using the column encode option. I would like to specify different colors for each label (Crookston, Duluth, etc). I have managed to set color for these labels from the labelColor parameter within alt.Header, however I only managed to set single colors. The spec I'm trying to define looks something like:

chart = alt.Chart(df).mark_bar().encode(
    alt.X("case", type="nominal"),
    alt.Y(col, type="quantitative"),
    alt.Color("case:N", scale=alt.Scale(range=colors)),
    alt.Column(
        "polygon",
        header=alt.Header(
            titleOrient='bottom',
            labelOrient='bottom',
            labelColor="black", # I would like this to be a list of colors instead
        ),
    ),
)

Thank you

0

There are 0 answers