I am trying to produce a graph with 10 variables that is not stack but sorted in a descending manner so that variables with "0" values are put at the back and those with "1" values sorted together for better visual display. Below is my syntax but I cannot manage to sort the data and my output looks like the attached picture.
Code:
graph bar fgrp1_carbs_produce fgrp2_pulses_produce fgrp3_nuts_produce fgrp4_d > airy_produce fgrp5_meat_produce fgrp6_eggs_produce fgrp7_greenveg_produce fgr > p8_otherfruitveg_produce fgrp9_otherveg_produce fgrp10_otherfruit_produce, ov > er(occupatn_cat,sort(2) descending label(labsize(small))) percent ylabel(0(20 > .0)100.0) bar(1, color("2 32 31")) bar(2, color("5 75 73")) bar(3, color("7 > 105 100"))bar(4, color("1 161 154")) bar(5, color("176 0 0")) bar(6, color("1 > 81 120 69")) bar(7, color("171 242 255")) bar(8, color("196 252 245")) bar(9 > , color("167 245 255")) bar(10, color("209 249 255")) legend(rows(5) label(1 > "Group 1(Grains/Tubers)") label(2 "Group 2(Pulses)") label(3 "Group 3 Nuts/Se > eds)") label(4 "Group 4(Dairy)") label(5 "Group 5(Meat/Fish)") label(6 "Group > 6(Eggs)") label(7 "Group 7(Dark green vegs)")label(8 "Group 8(Vit A-rich fru > its/vegs)")label(9 "Group 9(Other vegs)")label(10 "Group 10(Other fruits)")) > legend(size(small)) plotregion(style(none)) graphregion(color(white)) bargap( > 0) title(" Food groups produced", size(small) color(black))
Many thank!!
Array
0 Response to Sorting a graph bar without stacking
Post a Comment