topic Solution to sorting bar charts single by category count in Discussions
https://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53871#M30431
<P> </P><P>I banged my head against the wall figuring out how to sort a simple bar chart of a category (which graph builder can automatically count and display the proper bar heights for, but gives no sorting abillity by that count...). All the articles out there talk about sorting by some other continuous variable dropped into the merge zone of the graph builder <A href="http://www.jmp.com/support/notes/42/770.html" target="_self">http://www.jmp.com/support/notes/42/770.html</A> But I just want it sorted by the count of each category (you know, the ones that Graph Builder already counted! This is something matplotlib in python does automatically, btw, when you give it categories and counts). One solution out there is to make a summary table of that category...ugh, why make more tables to do such a simple thing!?</P><P> </P><P>So the easiest and most intuitive solution for me is to create a new column of 1's in your data table. Then whenever you chart a category, you drop the 1's (i called it <STRONG>count) column</STRONG> into the merge zone of the axis and <STRONG>choose sum</STRONG> as the statistic for sorting. Now all your categories can be bar charted and sorted by count.</P><P> </P><P>Yes, you could add <STRONG>ANY</STRONG> continuous column to the merge zone and <STRONG>choose N</STRONG> as your sort statistic, but I think this is odd because the chart then says "category sorted by 'unrelated continuous variable'" when it's really sorted by the counts (hence calling my column of 1's count). Yes, you could edit that text but holy cow, we are just applying band-aid after band-aid here. Also you would want to make sure your column you are sorting by has data in every row or the count's will be wrong. So again, I think the most intuitive solution is a column of 1's. It's elegant and ridiculous, just like JMP!</P><P> </P><P>Why graph buidler can't just do this on it's own is another wtf moment for JMP but hey I'm on 12, so maybe 13 can do this?</P><P> </P><P>Hope this helps, and please do enlighten me if I am missing something that makes this all easier/irrelevant. </P>Mon, 26 Mar 2018 19:50:05 GMTrossjason2018-03-26T19:50:05ZSolution to sorting bar charts single by category count
https://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53871#M30431
<P> </P><P>I banged my head against the wall figuring out how to sort a simple bar chart of a category (which graph builder can automatically count and display the proper bar heights for, but gives no sorting abillity by that count...). All the articles out there talk about sorting by some other continuous variable dropped into the merge zone of the graph builder <A href="http://www.jmp.com/support/notes/42/770.html" target="_self">http://www.jmp.com/support/notes/42/770.html</A> But I just want it sorted by the count of each category (you know, the ones that Graph Builder already counted! This is something matplotlib in python does automatically, btw, when you give it categories and counts). One solution out there is to make a summary table of that category...ugh, why make more tables to do such a simple thing!?</P><P> </P><P>So the easiest and most intuitive solution for me is to create a new column of 1's in your data table. Then whenever you chart a category, you drop the 1's (i called it <STRONG>count) column</STRONG> into the merge zone of the axis and <STRONG>choose sum</STRONG> as the statistic for sorting. Now all your categories can be bar charted and sorted by count.</P><P> </P><P>Yes, you could add <STRONG>ANY</STRONG> continuous column to the merge zone and <STRONG>choose N</STRONG> as your sort statistic, but I think this is odd because the chart then says "category sorted by 'unrelated continuous variable'" when it's really sorted by the counts (hence calling my column of 1's count). Yes, you could edit that text but holy cow, we are just applying band-aid after band-aid here. Also you would want to make sure your column you are sorting by has data in every row or the count's will be wrong. So again, I think the most intuitive solution is a column of 1's. It's elegant and ridiculous, just like JMP!</P><P> </P><P>Why graph buidler can't just do this on it's own is another wtf moment for JMP but hey I'm on 12, so maybe 13 can do this?</P><P> </P><P>Hope this helps, and please do enlighten me if I am missing something that makes this all easier/irrelevant. </P>Mon, 26 Mar 2018 19:50:05 GMThttps://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53871#M30431rossjason2018-03-26T19:50:05ZRe: Solution to sorting bar charts single by category count
https://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53880#M30438
<P>Hi Jason,</P>
<P>This is an improvement that is available JMP 13 and later. There is an Order By option that appears if you right click on the Axis, and you should be able to order by Counts, ascending or descending. </P>
<P> </P>
<P>You're in JMP 12, though. Some of the creative items you have described such as sorting by another column of 1s are tricks i have heard suggested before in order to solve this need. </P>
<P> </P>Mon, 26 Mar 2018 20:50:34 GMThttps://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53880#M30438audrey_shull2018-03-26T20:50:34ZRe: Solution to sorting bar charts single by category count
https://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53883#M30440
<P>thanks for the reply, Audrey. I'm glad to hear JMP 13 has a fix for this. I'm not sure when my organization (Intel) is going to upgrade us to 13 though, and I see 14 is coming out now...</P>Mon, 26 Mar 2018 21:07:28 GMThttps://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53883#M30440rossjason2018-03-26T21:07:28ZRe: Solution to sorting bar charts single by category count
https://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53889#M30443
<P>Hi <LI-USER uid="7847"></LI-USER>,</P>
<P>As <LI-USER uid="1893"></LI-USER> mentioned, improvements in JMP 13 make this easier. But, there is perhaps an easier way in JMP 12 and earlier you might be interested to know about. Graph Builder (like all platforms in JMP) respect the Value Ordering property set for a column. So, if you had an easy way to set the value ordering property for a variable based on counts you could make your plot in Graph Builder without having to worry about sorting by count. It turns out there is that exact capability from Analyze > Distribution. First, launch Analyze > Distribution with whatever variable will be your X axis in your final plot. Then, go to the Red Triangle > Order By > Count Descending (or Ascending). Return to the Red Triangle > Save > Value Ordering. This will set the value ordering property for that column, and now Graph Builder will automatically arrange your X levels honoring the count.</P>
<P>I hope this helps!</P>
<P><LI-USER uid="2026"></LI-USER></P>
<P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Save Value Ordering.gif" style="width: 999px;"><img src="https://kvoqx44227.i.lithium.com/t5/image/serverpage/image-id/10091i072963061330A9ED/image-size/large?v=1.0&px=999" title="Save Value Ordering.gif" alt="Save Value Ordering.gif" /></span></P>Mon, 26 Mar 2018 21:27:44 GMThttps://community.jmp.com/t5/Discussions/Solution-to-sorting-bar-charts-single-by-category-count/m-p/53889#M30443julian2018-03-26T21:27:44Z