I know these types of question seem silly but I have not found a solution with digging through the archives. I want to plot the values of variable 'yhat' over id and type, but I want to give the bars a colour using the asyvars option. In addition, I want to sort the order of the bars according to yhat. I have tried the following:
What happens, is my bars are no longer sort. They are sorted if I use
A data example:
Code:
graph bar yhat, over(type) over(id, sort(1)) asyvars nofill
Code:
graph bar yhat, over(id, sort(1)) nofill
Code:
+--------------------------------+ | id type yhat | |--------------------------------| 1. | 40 A 4.432507 | 2. | 48 A 5.10135 | 3. | 48 A 5.611093 | 4. | 48 A 6.062966 | 5. | 71 C 6.086926 | |--------------------------------| 6. | 79 A 6.172667 | 7. | 48 A 6.176242 | 8. | 48 A 6.28208 | 9. | 26 A 6.564067 | 10. | 79 A 6.851093 | |--------------------------------| 11. | 26 A 7.008502 | 12. | 32 C 7.029361 | 13. | 71 C 7.10641 | 14. | 26 A 7.187085 | 15. | 29 B 7.245084 | |--------------------------------| 16. | 35 A 7.364397 | 17. | 64 A 7.626135 | 18. | 32 C 7.707787 | 19. | 32 C 7.709017 | 20. | 26 A 7.753465 | +--------------------------------+
Comment