While creating some graphs I have discovered that a three line note overlaps with xaxis-title and (in some cases goes into the barregion). I use -catplot- (from ssc, v 2.0.2) for this example. The problem arises when I use the legend position 3 or 4. I wonder whether it is possible to avoid such overlaps without changing the legend position. In avoiding this problem I switched to -tabplot- (from ssc) which seems to be recommended anyway...

Array


The code used:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(ul_bench_u smfield _freq)
0  1  1
0  2  9
0  3  9
0  5  4
0  6 60
0  7  1
0  8  1
0  9  2
0 10  4
0 11  1
0 13  4
0 16 13
0 17  3
0 19  3
1  1  3
1  2  4
1  3  9
1  4  1
1  5 12
1  6 45
1  9  1
1 10 22
1 11  8
1 13  9
1 14  1
1 16 19
1 17  2
2  5  4
2 10  1
2 11  2
2 16  9
2 17  1
2 19  1
3  1  4
3  2 10
3  3  4
3  5  7
3  6 20
3  8  2
3 10  1
3 11  1
3 14  1
3 16  8
3 17  2
4  1  1
4  2  9
4  3  8
4  5 15
4  6 23
4  7  1
4  8  2
4  9  2
4 10  7
4 11  5
4 12  2
4 13  1
4 16 24
4 17  4
5  2  7
5  3 10
5  5  8
5  6 54
5  9  2
5 10  2
5 13  1
5 15  1
5 16 10
5 17  1
5 19  1
6  2  1
6  3  4
6  5 14
6  6 70
6  7  2
6  8  5
6  9  2
6 10  1
6 13  2
6 14  1
6 16 27
6 17  4
6 19  1
7  1  1
7  2 16
7  3 12
7  5 18
7  6 40
7  8  1
7 11  7
7 13  4
7 16 15
7 17  7
7 19  1
end
label values ul_bench_u l_ul_bench_u
label def l_ul_bench_u 0 "Uni A", modify
label def l_ul_bench_u 1 "Uni B", modify
label def l_ul_bench_u 2 "Uni C", modify
label def l_ul_bench_u 3 "Uni D", modify
label def l_ul_bench_u 4 "Uni E", modify
label def l_ul_bench_u 5 "Uni F", modify
label def l_ul_bench_u 6 "Uni G", modify
label def l_ul_bench_u 7 "Uni H", modify
label values smfield l_smfield
label def l_smfield 1 "Agriculture, Fisheries & Forestry", modify
label def l_smfield 2 "Biology", modify
label def l_smfield 3 "Biomedical Research", modify
label def l_smfield 4 "Built Environment & Design", modify
label def l_smfield 5 "Chemistry", modify
label def l_smfield 6 "Clinical Medicine", modify
label def l_smfield 7 "Communication & Textual Studies", modify
label def l_smfield 8 "Earth & Environmental Sciences", modify
label def l_smfield 9 "Economics & Business", modify
label def l_smfield 10 "Enabling & Strategic Technologies", modify
label def l_smfield 11 "Engineering", modify
label def l_smfield 12 "Historical Studies", modify
label def l_smfield 13 "Information & Communication Technologies", modify
label def l_smfield 14 "Mathematics & Statistics", modify
label def l_smfield 15 "Philosophy & Theology", modify
label def l_smfield 16 "Physics & Astronomy", modify
label def l_smfield 17 "Psychology & Cognitive Sciences", modify
label def l_smfield 19 "Social Sciences", modify
label var ul_bench_u "Selected universities"
label var smfield "Feldzuordnung"
label var _freq "Frequency"


catplot smfield [aw=_freq] , stack percent(ul_bench_u) over(ul_bench_u,  label(labs(small))) outergap(1.1) ///
                name(catp_ulb_sf_s2, replace) asy ///
                scheme(s2color)     ///
                legend(stack size(small) col(1) pos(4) region(lstyle(none)) keygap(.5) symy(.6)) ///
                ytitle("Prozent") l1title("") ///
                blabel(bar, pos(center) format(%8.0fc) size(tiny)) ///
                note("{stSerif:Quelle: Eigene Berechnungen nach}" "{stSerif:Ioannidis, John P. A.; Boyack, Kevin W.; Baas, Jeroen (2020): Updated science-wide author databases of standardized citation indicators.}" "{stSerif:In: PLoS biology 18 (10), e3000918. DOI: 10.1371/journal.pbio.3000918.}", span)