The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Historgam Question [SOLVED]
Alex_Pelaez
Member Posts: 3 Contributor I
I have a dataset, and am trying to create a histogram. Unfortunately, I am trying to sort the categories in the histogram. I have tried to sort the data set ,I even tried to create a new attribute. I cannot get the histogram to either show the highest frequencies on the left or the right. Can anyone provide some insight?
Alex
Alex
0
Answers
unfortunately it is not possible to sort the axes of the plotter explicitly. The values aren't sorted alphabetically either, but by the order they have been added to the dataset. So to get a sorted histogram, you have to create a new attribute and add the values ordered by their frequency. This requires a rather large and clumsy process, but it is possible: see the attached process.
After generating some data, it is aggregated manually by att1, the sorted by the frequencies. Then a new attribute natt1 is created, with the same values as att1. Since after sorting the example set is in the desired order, and Generate Attributes processes the data set from top to bottom, the values are added in the correct order. The problem is, that we are working on the aggregated data. You could now plot it using a scatter plot, but then you would have dots instead of bars. So we have to join it with the original data. Here it is important to do a left join, otherwise the order won't be kept.
The last two operators remove the original att1 and rename the new attribute natt1 to att1.
If you now create a histogram as usual on att1, it will be ordered by the frequencies.
Yes, it is quite complicated and confusing, but it's the only possibilty that comes into my mind. Maybe there is another creative head around who finds a better solution
Best, Marius