facebookresearch / hiplot

HiPlot makes understanding high dimensional data easy
https://facebookresearch.github.io/hiplot/
MIT License
2.74k stars 138 forks source link

Provide ability to define custom ordering for categorical variables #246

Closed sudeepag closed 2 years ago

sudeepag commented 2 years ago

It would be great if there was a way to define a custom ordering for categorical variables, or at least an ascending / descending option. I noticed that clicking on the label reverses it, but providing a way to customize the ordering would be very helpful.

danthe3rd commented 2 years ago

Hi @sudeepag and thanks for your feedback :)

Do you have an example for what type of custom ordering you would like to have?

Thanks

sudeepag commented 2 years ago

Hi @danthe3rd! For example in Plotly parcats plots, you can pass in a categoryorder, which can be ascending, descending, or just an array with a custom ordering.

danthe3rd commented 2 years ago

You can do this to invert the column default order - is it what you are looking for? I believe categorical values will be ordered alphabetically by default

    exp.display_data(hip.Displays. PARALLEL_PLOT).update({
        'invert': ['my_col_name'],
    })