Skip to content
Discussion options

You must be logged in to vote

Okay, after searching more deeply, I finally got a way to custom sort the color legends by using alt.Color(scale = alt.Scale(domain = custom_list)), but the Y axis remains unsorted.

EDIT2: Using scale parameter on both alt.Y and alt.Color seems to fix the ordering issue. Still, it's very confusing, many different ways just to sort colors/values.

Code:

c1 = []

for i, col in enumerate(['departure_time', 'arrival_time']):
    time_sort = ['Early_Morning', 'Morning', 'Afternoon', 'Evening', 'Night', 'Late_Night']

    c1.append(
        alt.Chart(
            df,
            title = alt.Title(
                f'Most Common {col.title().replace('_', ' ')} by Airline',
                anchor = '…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@AndhikaWB
Comment options

@ChristopherDavisUCI
Comment options

@AndhikaWB
Comment options

Answer selected by AndhikaWB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants