Dear all,
This is my first post on Statalist, hopefully the information is according to your expectation.
Below is an example plot.
This is my first post on Statalist, hopefully the information is according to your expectation.
Below is an example plot.
- How can I expand the legend to the width of the graph region?
- Next, how can I ensure that no text is covering the Keys?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long cat double(c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10) 1 0 27 27 32 32 33 34 34 35 36 36 2 0 17 17 22 22 23 23 24 25 26 26 3 0 20 20 23 23 24 25 25 26 26 26 4 0 16 16 21 21 22 22 23 23 23 23 5 0 19 20 22 22 22 22 24 26 29 30 6 0 20 20 27 27 27 27 27 27 27 27 7 0 16 16 18 18 21 21 21 26 26 26 8 0 18 19 22 22 22 22 22 26 26 26 9 0 16 16 22 22 23 24 24 24 24 24 10 0 17 18 21 21 24 25 25 27 28 28 11 0 15 15 20 20 21 21 21 21 21 21 12 0 16 17 24 24 27 27 27 28 30 30 13 0 17 18 23 23 24 25 26 27 28 28 14 0 19 20 24 24 24 24 25 26 26 26 15 0 15 16 21 21 23 25 25 26 26 26 16 0 15 15 22 22 24 24 24 25 28 28 17 0 16 17 24 24 24 26 26 29 30 30 18 0 21 21 27 27 29 31 31 34 38 38 19 0 28 28 32 32 32 33 33 34 35 35 20 0 29 29 32 32 32 33 33 33 35 35 21 0 27 28 32 32 33 33 33 34 36 36 22 0 26 26 30 30 31 31 31 34 34 34 23 0 23 23 23 23 23 24 24 27 27 28 24 0 23 23 23 23 23 23 23 23 23 23 25 0 23 23 23 23 23 26 26 29 29 29 26 0 23 23 23 23 23 23 23 29 29 35 27 0 23 23 23 23 23 23 23 23 23 23 end label values cat cat label def cat 1 "XXXXXXXXXX", modify label def cat 2 "XXXXXXXXXXXXXXXXXXXX", modify label def cat 3 "XXXXXXXXXXX", modify label def cat 4 "XXXXXXXXXXX", modify label def cat 5 "XXXXXX", modify label def cat 6 "XXXXXXXXXXX", modify label def cat 7 "XXXXXXXXXXXXX", modify label def cat 8 "XXXXXXXXXXXX", modify label def cat 9 "XXXXXXXXXXXXXXX", modify label def cat 10 "XXXXXXXXXXX", modify label def cat 11 "XXXXXXXXXXX", modify label def cat 12 "XXXXXXXXXXXXX", modify label def cat 13 "XXXXXXXXXXXXXXX", modify label def cat 14 "XXXXXXXXXXXXXXXXXX", modify label def cat 15 "XXXXXXXXXXXXXX", modify label def cat 16 "XXXXXXXXXXXXXXX", modify label def cat 17 "XXXXXXXXXXXX", modify label def cat 18 "XXXXXXXXXXXXXXX", modify label def cat 19 "XXXXXXXXXXXXXXXXXXXXX", modify label def cat 20 "XXXXXXXXXXXXXXXXXXXXXXXXX", modify label def cat 21 "XXXXXXXXXXXX", modify label def cat 22 "XXXXXXXXXXXXXXXXXX", modify label def cat 23 "XXXXXXXXXXXXXXX", modify label def cat 24 "XXXXXXXXXXXXXXXXXXXXXX", modify label def cat 25 "XXXXXXXXXXXXXXXXXXXXX", modify label def cat 26 "XXXXXX", modify label def cat 27 "XXXXXXXXXXXXXXXXXXXXX", modify local rbar_args barwidth(0.6) hor #delim; tw (rbar c0 c1 cat , `rbar_args' ) (rbar c1 c2 cat , `rbar_args' ) (rbar c2 c3 cat , `rbar_args' ) (rbar c3 c4 cat , `rbar_args' ) (rbar c4 c5 cat , `rbar_args' ) (rbar c5 c6 cat , `rbar_args' ) (rbar c6 c7 cat , `rbar_args' ) (rbar c7 c8 cat , `rbar_args' ) (rbar c8 c9 cat , `rbar_args' ) (rbar c9 c10 cat, `rbar_args' ) , ylab(1(1)`c(N)', angle(h) nogrid gmin gmax labsize(*0.6) val ) xlabel(0(10)100, grid gmin gmax labsize(*0.6)) yscale(reverse) xtitle("") ytitle("") ysize(8) xsize(6.8503) legend( order( 1 "aaaaaaa" "bbbbbbbbbbbbbbb" 2 "ccccccccccccc" 3 "dddddd" 4 "eeeeeeeeee" 5 "ffffffffffff-" "ggggggggggggg" 6 "hhhhh-" "iiiiii" 7 "jjjjjjjj-" "kkkkkk" 8 "llll-" "mmmmmmmmmmm" 9 "nnnn-" "ooooooooooo" 10 "ppppp" ) rows(2) symxsize(4) pos(6) ring(1) region(lstyle(none)) size(*0.5) ) scheme(s2color) plotregion(style(none)) graphregion(margin(l+20 r+5)) ; #delim cr
Comment