Hello.
I have data similar to the following :
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int price float group
 4099 4
 4749 4
 3799 4
 4816 4
 7827 2
 5788 4
 4453 4
 5189 4
10372 3
 4082 4
11385 3
14500 1
15906 1
 3299 4
 5705 4
 4504 4
 5104 4
 3667 4
 3955 4
 3984 4
 4010 4
 5886 4
 6342 4
 4389 4
 4187 4
11497 3
13594 1
13466 1
 3829 4
 5379 4
 6165 4
 4516 4
 6303 4
 3291 4
 8814 2
 5172 4
 4733 4
 4890 4
 4181 4
 4195 4
10371 3
 4647 4
 4425 4
 4482 4
 6486 4
 4060 4
 5798 4
 4934 4
 5222 4
 4723 4
 4424 4
 4172 4
 9690 2
 6295 4
 9735 2
 6229 4
 4589 4
 5079 4
 8129 2
 4296 4
 5799 4
 4499 4
 3995 4
12990 1
 3895 4
 3798 4
 5899 4
 3748 4
 5719 4
 7140 2
 5397 4
 4697 4
 6850 4
11995 3
end
label values group group_label1
label def group_label1 1 "A", modify
label def group_label1 2 "B", modify
label def group_label1 3 "C", modify
label def group_label1 4 "D", modify
I am making a binned scatter plot of price and group and I want to order the xaxis according to the size/value of the bins. I want to sort the bins in descending order. So after running:

Code:
  binscatter price group, xlabel(1 "A" 2 "B" 3 "C" 4 "D",  noticks)
I want the axis to be ordered A C B D and not A B C DArray .