pythonseaborncountplot

Ordering axis of seaborn.countplot


I'm plotting day of week frequencies from a list of strings dayWeek, where set(dayWeek) = {'Mon', 'Sun', 'Tue', 'Sat', 'Fri', 'Wed', 'Thu'}

It seems to just order the columns by the order that they appear in. How can I change the order to 'Sun'...'Sat' instead?

enter image description here


Solution

  • figured it out:

    k = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
    dayWeek = sorted(dayWeek, key=k.index)