[SOLVED] order of bars viewing discretized data

robm
robm New Altair Community Member
edited November 5 in Community Q&A
HI,
I have a series of data points with a percentage column and a value column. I have discretized the percentage column into 10 ranges, and I wish to see the average of the value column in each bin using the Bars plotter.  I can do this, but the order of columns, e.g. using 'range name type long' in the 'Discretize by binning' operator,  is 10,9,5,7,8,3,2,4,6,1.  I would prefer to have these strictly increasing or decreasing along the x-axis, which seems like a common requirement. Suggestions on how to do this are requested.

thank you,

rob.
Tagged:

Answers

  • tennenrishin
    tennenrishin New Altair Community Member
    I think this might work:

    Before outputting your ExampleSet
    1. Ensure that your bins are named in a way that will go alphabetically. E.g. 01, 02 ... 10. You might make use of Parse and Format operators here.
    2. Sort the ExampleSet by your binning attribute
    3. Perform a dummy identity generation on your binning attribute. I.e. Use the Generate Attributes operator to assign your_binning_attribute=your_binning_attribute

    The last step will make RM refresh the mapping order on that nominal set, I think.
  • robm
    robm New Altair Community Member
    Thank you!
    Of course you are right, the solution is in sorting the data points before graphing.  I realised later that the random order of the bins must have been simply the order they were presented in.
    For my problem, all I needed was a copy of the pre-discretized data column and sorted on that, thus the bins are presented in the order I want.