Subscribe Bookmark


Jun 13, 2014

Ordering categorical graph elements

When JMP has to put categorical values in order, such as in table rows or a graph axis, it will use alphabetical order if there is no order defined for the column. JMP knows about the order of a few common categorical values, such as month names and Likert scale values. For others, you can add a Value Ordering column property. For instance, A-level credit ratings would be ordered alphabetically as “A, A-, A+, AA, AA-, AA+, AAA.” However, you can have them always ordered from best to worst by adding a Value Ordering property to the column:

That’s fine for static, predetermined ordering, but what about more dynamic order? For instance, how would you organize a bar chart or histogram so that the bars are in descending order of length? That’s a job for Graph Builder’s little-known ability to apply an order variable to any categorical axis.

Let’s say I have a file with sales data by Distribution Channel, Customer ID and Product Line:

I want a distribution graph organized by the number of records by product line. I first create a distribution graph:

The initial graph will be ordered alphabetically (bottom-to-top). In order to re-order them, I first need to merge a continuous variable with the Y axis. Now this can be any continuous variable, even a column with random numbers. The only important factor is that it is continuous. Since I have a revenue column, I’ll use that one. The “merge” drop zone is just inside the graph next to the axis you want to merge with.

The default is for the data to be sorted by the mean of the continuous variable, in this case Revenue. In order to change it to the count of the records, you right-click on the Y axis and change the Order Statistic to N:

The graph will then be sorted by the number of rows in each category.

Right-click the Y axis a second time to flip the order (ascending to descending).

The same technique applies to any categorical axis or grouping in Graph Builder.

Community Member

Jules wrote:

Thank you!!! I was trying to do this for the longest time on graph builder and I couldn't figure out how for the longest time. Made the rest of my year :)

Community Member

Brian wrote:

this option doesn't seem to be available in JMP 11. the ordering option does not appear when right clicking the Y axis in a distribution report. how does this work in JMP 11?

Community Member

Edzard van Santen wrote:

How do I reverse the process without starting from scratch. Reason for reversion is that I might want to create a Pie-chart from the data.

Charles Pirrello wrote:


The steps to set this up in JMP11 are pretty much the same. First you drag you categorical variable to the graph, then merge a continuous variable, right mouse click on the axis label and select, Order Statistic, N. The only difference is to remove the order statistic, you simply right click again and select Remove Order.

Charles Pirrello wrote:

Hi Edward,

Hi Edzard,

Iâ m working with JMP version 11, so if you have an older version you may need to validate this answer. To undo the Statistical Order is a simple task. Just right click on the axis label and select â Remove Orderâ . This will remove the variable that was used to order your categorical data. You can also simply click the Undo button to back up as many steps as necessary.