[Solved] Set an Order for Strings in a Column

Hello Everyone,

after 2hours research without any usable results i'm seeking out for your help.

lets say you have a collumn "Car Brands" and i want to plot that, i want to set a preorder for these brands so that i have less expensive brands like Toyota, VW, Honda on the left side of the x-Axis and the more expensive ones on the right side like BMW, Ferrari and things like that. It's obvious that there is no other way then setting them manually up.

my workaround so far is, that i used the rule engine node to insert an extra column based on the string with an Integer like 1 for toyota and 10 for ferrari, but its not nice to look at numbers in the plot instead of their names :(

i hope i explained my problem in a way you can relate to...

thanks for any help =)

greetings, Jawed

Hi Jawed,

if the criterion you want to sort by your columnsĀ is not in the origin dataset, the insertion of a dummy-variable like you did is probably the only possibility you have, as there is no option for customizing the order of columns within the plot configuration.

Anyway, you don't have to use the numbers as labels in the plot. After inserting the dummy-variableĀ use a groupBy nodeĀ to perform the aggregations that would normally do the plot for you, e.g. count number of occurences. Additionally compute the mean of your dummy-variable. Next sort the data by your dummy variably, obviously with a sorter node and lastly connect this node with your plot node.

For clarification I added a simple example workflow for you. Hope that helps.

Cheers,
Marten

1 Like

oh cool, thats exaclty what i was looking for!

thanks marten =)